16  Spatial Interaction Models

Published

January 24, 2023

Modified

November 28, 2023

16.1 Overview

Spatial interaction represent the flow of people, material, or information between locations in geographical space. It encompasses everything from freight shipments, energy flows, and the global trade in rare antiquities, to flight schedules, rush hour woes, and pedestrian foot traffic. Understanding what factors and logic went into the decision-making behind those human-induced movements and interdependencies is important because it enables policy makwers to better understand, predict, manage, and help plan for such circulation. For example, policy makers can make informed decisions about how to better allocate resources to improve traffic in a city or to speed up shipments of perishable foodstuffs. It has to do with having a good understanding of the overall situation.

Spatial Interaction Models (SIMs) are mathematical models for estimating movement between spatial entities developed by Alan Wilson in the late 1960s and early 1970, with considerable uptake and refinement for transport modelling since then Boyce and Williams (2015). There are four main types of traditional SIMs (Wilson 1971): - Unconstrained - Production-constrained - Attraction-constrained - Doubly-constrained

Both ordinary least square (OLS) and negative binomial (NB) regression methods have been used extensively to calibrate OD flow models by processing flow data as different types of dependent variables.

16.2 Getting Started

For the purpose of this exercise, four r packages will be used. They are:

  • sf for importing, integrating, processing and transforming geospatial data.
  • tidyverse for importing, integrating, wrangling and visualising data.
  • tmap for creating thematic maps.
pacman::p_load(tmap, sf, DT, stplanr,
               performance,
               ggpubr, tidyverse)

16.3 Preparing the Flow Data

16.3.1 Importing the OD data

Firstly, we will import the Passenger Volume by Origin Destination Bus Stops data set downloaded from LTA DataMall by using read_csv() of readr package.

odbus <- read_csv("chap15/data/aspatial/origin_destination_bus_202210.csv")

Let use display the odbus tibble data table by using the code chunk below.

glimpse(odbus)
Rows: 5,122,925
Columns: 7
$ YEAR_MONTH          <chr> "2022-10", "2022-10", "2022-10", "2022-10", "2022-…
$ DAY_TYPE            <chr> "WEEKDAY", "WEEKENDS/HOLIDAY", "WEEKENDS/HOLIDAY",…
$ TIME_PER_HOUR       <dbl> 10, 10, 7, 11, 16, 16, 20, 7, 7, 11, 11, 8, 11, 11…
$ PT_TYPE             <chr> "BUS", "BUS", "BUS", "BUS", "BUS", "BUS", "BUS", "…
$ ORIGIN_PT_CODE      <dbl> 65239, 65239, 23519, 52509, 54349, 54349, 43371, 8…
$ DESTINATION_PT_CODE <dbl> 65159, 65159, 23311, 42041, 53241, 53241, 14139, 9…
$ TOTAL_TRIPS         <dbl> 2, 1, 2, 1, 1, 4, 1, 3, 1, 5, 2, 5, 15, 40, 1, 1, …

A quick check of odbus tibble data frame shows that the values in OROGIN_PT_CODE and DESTINATON_PT_CODE are in numeric data type. Hence, the code chunk below is used to convert these data values into character data type.

odbus$ORIGIN_PT_CODE <- as.factor(odbus$ORIGIN_PT_CODE)
odbus$DESTINATION_PT_CODE <- as.factor(odbus$DESTINATION_PT_CODE) 

16.3.2 Extracting the study data

For the purpose of this exercise, we will extract commuting flows on weekday and between 6 and 9 o’clock.

odbus6_9 <- odbus %>%
  filter(DAY_TYPE == "WEEKDAY") %>%
  filter(TIME_PER_HOUR >= 6 &
           TIME_PER_HOUR <= 9) %>%
  group_by(ORIGIN_PT_CODE,
           DESTINATION_PT_CODE) %>%
  summarise(TRIPS = sum(TOTAL_TRIPS))

Table below shows the content of odbus6_9

datatable(odbus6_9)

We will save the output in rds format for future used.

write_rds(odbus6_9, "chap15/data/rds/odbus6_9.rds")

The code chunk below will be used to import the save odbus6_9.rds into R environment.

odbus6_9 <- read_rds("chap15/data/rds/odbus6_9.rds")

16.4 Working with Geospatial Data

For the purpose of this exercise, two geospatial data will be used. They are:

  • BusStop: This data provides the location of bus stop as at last quarter of 2022.
  • MPSZ-2019: This data provides the sub-zone boundary of URA Master Plan 2019.

Both data sets are in ESRI shapefile format.

16.4.1 Importing geospatial data

Two geospatial data will be used in this exercise, they are:

busstop <- st_read(dsn = "chap15/data/geospatial",
                   layer = "BusStop") %>%
  st_transform(crs = 3414)
Reading layer `BusStop' from data source `D:\tskam\r4gdsa\chap15\data\geospatial' using driver `ESRI Shapefile'
Simple feature collection with 5159 features and 3 fields
Geometry type: POINT
Dimension:     XY
Bounding box:  xmin: 3970.122 ymin: 26482.1 xmax: 48284.56 ymax: 52983.82
Projected CRS: SVY21
mpsz <- st_read(dsn = "chap15/data/geospatial",
                   layer = "MPSZ-2019") %>%
  st_transform(crs = 3414)
Reading layer `MPSZ-2019' from data source 
  `D:\tskam\r4gdsa\chap15\data\geospatial' using driver `ESRI Shapefile'
Simple feature collection with 332 features and 6 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 103.6057 ymin: 1.158699 xmax: 104.0885 ymax: 1.470775
Geodetic CRS:  WGS 84
mpsz
Simple feature collection with 332 features and 6 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 2667.538 ymin: 15748.72 xmax: 56396.44 ymax: 50256.33
Projected CRS: SVY21 / Singapore TM
First 10 features:
                 SUBZONE_N SUBZONE_C       PLN_AREA_N PLN_AREA_C       REGION_N
1              MARINA EAST    MESZ01      MARINA EAST         ME CENTRAL REGION
2         INSTITUTION HILL    RVSZ05     RIVER VALLEY         RV CENTRAL REGION
3           ROBERTSON QUAY    SRSZ01  SINGAPORE RIVER         SR CENTRAL REGION
4  JURONG ISLAND AND BUKOM    WISZ01  WESTERN ISLANDS         WI    WEST REGION
5             FORT CANNING    MUSZ02           MUSEUM         MU CENTRAL REGION
6         MARINA EAST (MP)    MPSZ05    MARINE PARADE         MP CENTRAL REGION
7                   SUDONG    WISZ03  WESTERN ISLANDS         WI    WEST REGION
8                  SEMAKAU    WISZ02  WESTERN ISLANDS         WI    WEST REGION
9           SOUTHERN GROUP    SISZ02 SOUTHERN ISLANDS         SI CENTRAL REGION
10                 SENTOSA    SISZ01 SOUTHERN ISLANDS         SI CENTRAL REGION
   REGION_C                       geometry
1        CR MULTIPOLYGON (((33222.98 29...
2        CR MULTIPOLYGON (((28481.45 30...
3        CR MULTIPOLYGON (((28087.34 30...
4        WR MULTIPOLYGON (((14557.7 304...
5        CR MULTIPOLYGON (((29542.53 31...
6        CR MULTIPOLYGON (((35279.55 30...
7        WR MULTIPOLYGON (((15772.59 21...
8        WR MULTIPOLYGON (((19843.41 21...
9        CR MULTIPOLYGON (((30870.53 22...
10       CR MULTIPOLYGON (((26879.04 26...
Note
  • st_read() function of sf package is used to import the shapefile into R as sf data frame.
  • st_transform() function of sf package is used to transform the projection to crs 3414.

16.5 Geospatial data wrangling

16.5.1 Combining Busstop and mpsz

Code chunk below populates the planning subzone code (i.e. SUBZONE_C) of mpsz sf data frame into busstop sf data frame.

busstop_mpsz <- st_intersection(busstop, mpsz) %>%
  select(BUS_STOP_N, SUBZONE_C) %>%
  st_drop_geometry()
Note
  • st_intersection() is used to perform point and polygon overly and the output will be in point sf object.
  • select() of dplyr package is then use to retain only BUS_STOP_N and SUBZONE_C in the busstop_mpsz sf data frame.
  • five bus stops are excluded in the resultant data frame because they are outside of Singapore bpundary.
datatable(busstop_mpsz)

Before moving to the next step, it is wise to save the output into rds format.

write_rds(busstop_mpsz, "chap15/data/rds/busstop_mpsz.rds")  

Next, we are going to append the planning subzone code from busstop_mpsz data frame onto odbus6_9 data frame.

od_data <- left_join(odbus6_9 , busstop_mpsz,
            by = c("ORIGIN_PT_CODE" = "BUS_STOP_N")) %>%
  rename(ORIGIN_BS = ORIGIN_PT_CODE,
         ORIGIN_SZ = SUBZONE_C,
         DESTIN_BS = DESTINATION_PT_CODE)

Before continue, it is a good practice for us to check for duplicating records.

duplicate <- od_data %>%
  group_by_all() %>%
  filter(n()>1) %>%
  ungroup()

If duplicated records are found, the code chunk below will be used to retain the unique records.

od_data <- unique(od_data)

It will be a good practice to confirm if the duplicating records issue has been addressed fully.

Next, we will update od_data data frame cwith the planning subzone codes.

od_data <- left_join(od_data , busstop_mpsz,
            by = c("DESTIN_BS" = "BUS_STOP_N")) 
duplicate <- od_data %>%
  group_by_all() %>%
  filter(n()>1) %>%
  ungroup()
od_data <- unique(od_data)
od_data <- od_data %>%
  rename(DESTIN_SZ = SUBZONE_C) %>%
  drop_na() %>%
  group_by(ORIGIN_SZ, DESTIN_SZ) %>%
  summarise(MORNING_PEAK = sum(TRIPS))

It is time to save the output into an rds file format.

write_rds(od_data, "chap15/data/rds/od_data.rds")
od_data <- read_rds("chap15/data/rds/od_data.rds")

16.6 Visualising Spatial Interaction

In this section, you will learn how to prepare a desire line by using stplanr package.

16.6.1 Removing intra-zonal flows

We will not plot the intra-zonal flows. The code chunk below will be used to remove intra-zonal flows.

od_data1 <- od_data[od_data$ORIGIN_SZ!=od_data$DESTIN_SZ,]

16.6.2 Creating desire lines

In this code chunk below, od2line() of stplanr package is used to create the desire lines.

flowLine <- od2line(flow = od_data1, 
                    zones = mpsz,
                    zone_code = "SUBZONE_C")

16.6.3 Visualising the desire lines

To visualise the resulting desire lines, the code chunk below is used.

tm_shape(mpsz) +
  tm_polygons() +
flowLine %>%  
  filter(MORNING_PEAK >= 5000) %>%
tm_shape() +
  tm_lines(lwd = "MORNING_PEAK",
           style = "quantile",
           scale = c(0.1, 1, 3, 5, 10),
           n = 5,
           alpha = 0.3)

Warning

Be patient, the rendering process takes more time because of the transparency argument (i.e. alpha)

16.7 Visualising the Geospatial Data

tmap_mode("plot")
tmap_options(check.and.fix = TRUE)
qtm(mpsz)

16.8 Viewing the Subzone spatial file

head(mpsz, 10)
Simple feature collection with 10 features and 6 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 8012.578 ymin: 15748.72 xmax: 35287.9 ymax: 31092.38
Projected CRS: SVY21 / Singapore TM
                 SUBZONE_N SUBZONE_C       PLN_AREA_N PLN_AREA_C       REGION_N
1              MARINA EAST    MESZ01      MARINA EAST         ME CENTRAL REGION
2         INSTITUTION HILL    RVSZ05     RIVER VALLEY         RV CENTRAL REGION
3           ROBERTSON QUAY    SRSZ01  SINGAPORE RIVER         SR CENTRAL REGION
4  JURONG ISLAND AND BUKOM    WISZ01  WESTERN ISLANDS         WI    WEST REGION
5             FORT CANNING    MUSZ02           MUSEUM         MU CENTRAL REGION
6         MARINA EAST (MP)    MPSZ05    MARINE PARADE         MP CENTRAL REGION
7                   SUDONG    WISZ03  WESTERN ISLANDS         WI    WEST REGION
8                  SEMAKAU    WISZ02  WESTERN ISLANDS         WI    WEST REGION
9           SOUTHERN GROUP    SISZ02 SOUTHERN ISLANDS         SI CENTRAL REGION
10                 SENTOSA    SISZ01 SOUTHERN ISLANDS         SI CENTRAL REGION
   REGION_C                       geometry
1        CR MULTIPOLYGON (((33222.98 29...
2        CR MULTIPOLYGON (((28481.45 30...
3        CR MULTIPOLYGON (((28087.34 30...
4        WR MULTIPOLYGON (((14557.7 304...
5        CR MULTIPOLYGON (((29542.53 31...
6        CR MULTIPOLYGON (((35279.55 30...
7        WR MULTIPOLYGON (((15772.59 21...
8        WR MULTIPOLYGON (((19843.41 21...
9        CR MULTIPOLYGON (((30870.53 22...
10       CR MULTIPOLYGON (((26879.04 26...

16.9 Isolating SUBZONE_C (subzone_code) into a new df

mpsz <- mpsz[order(mpsz$SUBZONE_C),]
head(mpsz, 10)
Simple feature collection with 10 features and 6 fields
Geometry type: MULTIPOLYGON
Dimension:     XY
Bounding box:  xmin: 26154.57 ymin: 37511.2 xmax: 31072.47 ymax: 41804.65
Projected CRS: SVY21 / Singapore TM
                 SUBZONE_N SUBZONE_C PLN_AREA_N PLN_AREA_C          REGION_N
171 ANG MO KIO TOWN CENTRE    AMSZ01 ANG MO KIO         AM NORTH-EAST REGION
170              CHENG SAN    AMSZ02 ANG MO KIO         AM NORTH-EAST REGION
163             CHONG BOON    AMSZ03 ANG MO KIO         AM NORTH-EAST REGION
330             TOWNSVILLE    AMSZ04 ANG MO KIO         AM NORTH-EAST REGION
329             SHANGRI-LA    AMSZ05 ANG MO KIO         AM NORTH-EAST REGION
172            KEBUN BAHRU    AMSZ06 ANG MO KIO         AM NORTH-EAST REGION
233        SEMBAWANG HILLS    AMSZ07 ANG MO KIO         AM NORTH-EAST REGION
254                 TAGORE    AMSZ08 ANG MO KIO         AM NORTH-EAST REGION
242      YIO CHU KANG WEST    AMSZ09 ANG MO KIO         AM NORTH-EAST REGION
252           YIO CHU KANG    AMSZ10 ANG MO KIO         AM NORTH-EAST REGION
    REGION_C                       geometry
171      NER MULTIPOLYGON (((29692.8 389...
170      NER MULTIPOLYGON (((30384.33 39...
163      NER MULTIPOLYGON (((30676.17 39...
330      NER MULTIPOLYGON (((29649.88 38...
329      NER MULTIPOLYGON (((28228.2 392...
172      NER MULTIPOLYGON (((28491.21 39...
233      NER MULTIPOLYGON (((27744.03 38...
254      NER MULTIPOLYGON (((27193.46 41...
242      NER MULTIPOLYGON (((29269.91 39...
252      NER MULTIPOLYGON (((29598.36 39...

16.10 Computing Distance Matrix

The are at least two ways to compute the required distance matrix. One is based on sf and the other is based on sp. Past experience shows that computing distance matrix by using sf function took relatively longer time that sp method. In view of this, sp method is used in the code chunks below.

16.10.1 Converting from sf data.table to SpatialPolygonDataFrame

mpsz_sp <- as(mpsz, "Spatial")

16.10.2 Computing the distance matrix

dist <- spDists(mpsz_sp)
dist 

16.10.3 Sorting the distance matrix by plannint sub-zone code

sz_names <- mpsz$SUBZONE_C

16.10.4 Attaching SUBZONE_C to row and column for distance matrix matching ahead

colnames(dist) <- paste0(sz_names)
rownames(dist) <- paste0(sz_names)

16.10.5 Pivoting distance value by SUBZONE_C

distPair <- melt(dist) %>%
  rename(dist = value)
head(distPair, 10)

16.10.6 Updating intra-zonal distances

distPair %>%
  filter(dist > 0) %>%
  summary()

A constant distance value of 50m is added into intra-zones

distPair$dist <- ifelse(distPair$dist == 0,
                        50, distPair$dist)

The code chunk below will be used to check the result data.frame.

distPair %>%
  summary()

The code chunk below is used to rename the origin and destination fields.

distPair <- distPair %>%
  rename(orig = Var1,
         dest = Var2)

Lastly, code chunk is used to save the data frame for future use.

write_rds(distPair, "data/distPair.rds") 

16.11 Preparing flow data

The code chunk below is used to prepared the flow_data.

od_data <- read_rds("chap15/data/rds/od_data.rds")
flow_data <- od_data %>%
  group_by(ORIGIN_SZ, DESTIN_SZ) %>% 
  summarize(TRIPS = sum(TRIPS)) 

The code chunk below is used to view the passenger volume df

head(flow_data, 10)

16.11.1 Separating intra-flow from passenger volume df

flow_data$FlowNoIntra <- ifelse(
  flow_data$ORIGIN_SZ == flow_data$DESTIN_SZ, 
  0, flow_data$TRIPS)
flow_data$offset <- ifelse(
  flow_data$ORIGIN_SZ == flow_data$DESTIN_SZ, 
  0.000001, 1)

16.11.2 Combining passenger volume data with distance value

flow_data$ORIGIN_SZ <- as.factor(flow_data$ORIGIN_SZ)
flow_data$DESTIN_SZ <- as.factor(flow_data$DESTIN_SZ)
flow_data1 <- flow_data %>%
  left_join (distPair,
             by = c("ORIGIN_SZ" = "orig",
                    "DESTIN_SZ" = "dest"))

16.12 Preparing Origin and Destination Attributes

16.12.1 Importing population data

pop <- read_csv("chap15/data/aspatial/pop.csv")

16.12.2 Geospatial data wrangling

pop <- pop %>%
  left_join(mpsz,
            by = c("PA" = "PLN_AREA_N",
                   "SZ" = "SUBZONE_N")) %>%
  select(1:6) %>%
  rename(SZ_NAME = SZ,
         SZ = SUBZONE_C)

16.12.3 Preparing origin attribute

flow_data1 <- flow_data1 %>%
  left_join(pop,
            by = c(ORIGIN_SZ = "SZ")) %>%
  rename(ORIGIN_AGE7_12 = AGE7_12,
         ORIGIN_AGE13_24 = AGE13_24,
         ORIGIN_AGE25_64 = AGE25_64) %>%
  select(-c(PA, SZ_NAME))

16.12.4 Preparing destination attribute

flow_data1 <- flow_data1 %>%
  left_join(pop,
            by = c(DESTIN_SZ = "SZ")) %>%
  rename(DESTIN_AGE7_12 = AGE7_12,
         DESTIN_AGE13_24 = AGE13_24,
         DESTIN_AGE25_64 = AGE25_64) %>%
  select(-c(PA, SZ_NAME))
write_rds(flow_data1, "chap15/data/rds/SIM_data")

16.13 Calibrating Spatial Interaction Models

In this section, you will learn how to calibrate Spatial Interaction Models by using Poisson Regression method.

16.13.1 Importing the modelling data

Firstly, let us import the modelling data by using the code chunk below.

SIM_data <- read_rds("chap15/data/rds/SIM_data.rds")

16.13.2 Visualising the dependent variable

Firstly, let us plot the distribution of the dependent variable (i.e. TRIPS) by using histogram method by using the code chunk below.

ggplot(data = SIM_data,
       aes(x = TRIPS)) +
  geom_histogram()

Notice that the distribution is highly skewed and not resemble bell shape or also known as normal distribution.

Next, let us visualise the relation between the dependent variable and one of the key independent variable in Spatial Interaction Model, namely distance.

ggplot(data = SIM_data,
       aes(x = dist,
           y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

Notice that their relationship hardly resemble linear relationship.

On the other hand, if we plot the scatter plot by using the log transformed version of both variables, we can see that their relationship is more resemble linear relationship.

ggplot(data = SIM_data,
       aes(x = log(dist),
           y = log(TRIPS))) +
  geom_point() +
  geom_smooth(method = lm)

16.13.3 Checking for variables with zero values

Since Poisson Regression is based of log and log 0 is undefined, it is important for us to ensure that no 0 values in the explanatory variables.

In the code chunk below, summary() of Base R is used to compute the summary statistics of all variables in SIM_data data frame.

summary(SIM_data)
  ORIGIN_SZ          DESTIN_SZ             TRIPS           FlowNoIntra      
 Length:14274       Length:14274       Min.   :     1.0   Min.   :     1.0  
 Class :character   Class :character   1st Qu.:    11.0   1st Qu.:    11.0  
 Mode  :character   Mode  :character   Median :    56.0   Median :    56.0  
                                       Mean   :   664.3   Mean   :   664.3  
                                       3rd Qu.:   296.0   3rd Qu.:   296.0  
                                       Max.   :104167.0   Max.   :104167.0  
     offset       dist         ORIGIN_AGE7_12 ORIGIN_AGE13_24 ORIGIN_AGE25_64
 Min.   :1   Min.   :  173.8   Min.   :   0   Min.   :    0   Min.   :    0  
 1st Qu.:1   1st Qu.: 3465.4   1st Qu.: 240   1st Qu.:  460   1st Qu.: 2210  
 Median :1   Median : 6121.0   Median : 710   Median : 1400   Median : 7030  
 Mean   :1   Mean   : 6951.8   Mean   :1037   Mean   : 2278   Mean   :10536  
 3rd Qu.:1   3rd Qu.: 9725.1   3rd Qu.:1500   3rd Qu.: 3282   3rd Qu.:15830  
 Max.   :1   Max.   :26135.8   Max.   :6340   Max.   :16380   Max.   :74610  
 DESTIN_AGE7_12 DESTIN_AGE13_24 DESTIN_AGE25_64
 Min.   :   0   Min.   :    0   Min.   :    0  
 1st Qu.: 250   1st Qu.:  460   1st Qu.: 2210  
 Median : 720   Median : 1430   Median : 7120  
 Mean   :1040   Mean   : 2305   Mean   :10648  
 3rd Qu.:1500   3rd Qu.: 3290   3rd Qu.:15830  
 Max.   :6340   Max.   :16380   Max.   :74610  

The print report above reveals that variables ORIGIN_AGE7_12, ORIGIN_AGE13_24, ORIGIN_AGE25_64,DESTIN_AGE7_12, DESTIN_AGE13_24, DESTIN_AGE25_64 consist of 0 values.

In view of this, code chunk below will be used to replace zero values to 0.99.

SIM_data$DESTIN_AGE7_12 <- ifelse(
  SIM_data$DESTIN_AGE7_12 == 0,
  0.99, SIM_data$DESTIN_AGE7_12)
SIM_data$DESTIN_AGE13_24 <- ifelse(
  SIM_data$DESTIN_AGE13_24 == 0,
  0.99, SIM_data$DESTIN_AGE13_24)
SIM_data$DESTIN_AGE25_64 <- ifelse(
  SIM_data$DESTIN_AGE25_64 == 0,
  0.99, SIM_data$DESTIN_AGE25_64)
SIM_data$ORIGIN_AGE7_12 <- ifelse(
  SIM_data$ORIGIN_AGE7_12 == 0,
  0.99, SIM_data$ORIGIN_AGE7_12)
SIM_data$ORIGIN_AGE13_24 <- ifelse(
  SIM_data$ORIGIN_AGE13_24 == 0,
  0.99, SIM_data$ORIGIN_AGE13_24)
SIM_data$ORIGIN_AGE25_64 <- ifelse(
  SIM_data$ORIGIN_AGE25_64 == 0,
  0.99, SIM_data$ORIGIN_AGE25_64)

You can run the summary() again.

summary(SIM_data)
  ORIGIN_SZ          DESTIN_SZ             TRIPS           FlowNoIntra      
 Length:14274       Length:14274       Min.   :     1.0   Min.   :     1.0  
 Class :character   Class :character   1st Qu.:    11.0   1st Qu.:    11.0  
 Mode  :character   Mode  :character   Median :    56.0   Median :    56.0  
                                       Mean   :   664.3   Mean   :   664.3  
                                       3rd Qu.:   296.0   3rd Qu.:   296.0  
                                       Max.   :104167.0   Max.   :104167.0  
     offset       dist         ORIGIN_AGE7_12    ORIGIN_AGE13_24   
 Min.   :1   Min.   :  173.8   Min.   :   0.99   Min.   :    0.99  
 1st Qu.:1   1st Qu.: 3465.4   1st Qu.: 240.00   1st Qu.:  460.00  
 Median :1   Median : 6121.0   Median : 710.00   Median : 1400.00  
 Mean   :1   Mean   : 6951.8   Mean   :1036.73   Mean   : 2278.59  
 3rd Qu.:1   3rd Qu.: 9725.1   3rd Qu.:1500.00   3rd Qu.: 3282.50  
 Max.   :1   Max.   :26135.8   Max.   :6340.00   Max.   :16380.00  
 ORIGIN_AGE25_64    DESTIN_AGE7_12    DESTIN_AGE13_24    DESTIN_AGE25_64   
 Min.   :    0.99   Min.   :   0.99   Min.   :    0.99   Min.   :    0.99  
 1st Qu.: 2210.00   1st Qu.: 250.00   1st Qu.:  460.00   1st Qu.: 2210.00  
 Median : 7030.00   Median : 720.00   Median : 1430.00   Median : 7120.00  
 Mean   :10535.93   Mean   :1039.98   Mean   : 2305.33   Mean   :10647.95  
 3rd Qu.:15830.00   3rd Qu.:1500.00   3rd Qu.: 3290.00   3rd Qu.:15830.00  
 Max.   :74610.00   Max.   :6340.00   Max.   :16380.00   Max.   :74610.00  

Notice that all the 0 values have been replaced by 0.99.

16.13.4 Unconstrained Spatial Interaction Model

In this section, you will learn how to calibrate an unconstrained spatial interaction model by using glm() of Base Stats. The explanatory variables are origin population by different age cohort, destination population by different age cohort (i.e. wj3_destmedinc) and distance between origin and destination in km (i.e. dist).

The general formula of Unconstrained Spatial Interaction Model

The code chunk used to calibrate to model is shown below:

uncSIM <- glm(formula = TRIPS ~ 
                log(ORIGIN_AGE25_64) + 
                log(DESTIN_AGE25_64) +
                log(dist),
              family = poisson(link = "log"),
              data = SIM_data,
              na.action = na.exclude)
uncSIM

Call:  glm(formula = TRIPS ~ log(ORIGIN_AGE25_64) + log(DESTIN_AGE25_64) + 
    log(dist), family = poisson(link = "log"), data = SIM_data, 
    na.action = na.exclude)

Coefficients:
         (Intercept)  log(ORIGIN_AGE25_64)  log(DESTIN_AGE25_64)  
            17.00287               0.21001               0.01289  
           log(dist)  
            -1.51785  

Degrees of Freedom: 14273 Total (i.e. Null);  14270 Residual
Null Deviance:      36120000 
Residual Deviance: 19960000     AIC: 20040000

16.13.5 R-squared function

In order to measure how much variation of the trips can be accounted by the model we will write a function to calculate R-Squared value as shown below.

CalcRSquared <- function(observed,estimated){
  r <- cor(observed,estimated)
  R2 <- r^2
  R2
}

Next, we will compute the R-squared of the unconstrained SIM by using the code chunk below.

CalcRSquared(uncSIM$data$TRIPS, uncSIM$fitted.values)
[1] 0.1694734
r2_mcfadden(uncSIM)
# R2 for Generalized Linear Regression
       R2: 0.446
  adj. R2: 0.446

16.13.6 Origin (Production) constrained SIM

In this section, we will fit an origin constrained SIM by using the code3 chunk below.

The general formula of Origin Constrained Spatial Interaction Model

orcSIM <- glm(formula = TRIPS ~ 
                 ORIGIN_SZ +
                 log(DESTIN_AGE25_64) +
                 log(dist),
              family = poisson(link = "log"),
              data = SIM_data,
              na.action = na.exclude)
summary(orcSIM)

Call:
glm(formula = TRIPS ~ ORIGIN_SZ + log(DESTIN_AGE25_64) + log(dist), 
    family = poisson(link = "log"), data = SIM_data, na.action = na.exclude)

Coefficients:
                       Estimate Std. Error   z value Pr(>|z|)    
(Intercept)          19.9309957  0.0054015  3689.887  < 2e-16 ***
ORIGIN_SZAMSZ02       0.6805710  0.0052686   129.175  < 2e-16 ***
ORIGIN_SZAMSZ03       0.3597850  0.0054884    65.554  < 2e-16 ***
ORIGIN_SZAMSZ04      -0.1106566  0.0060027   -18.434  < 2e-16 ***
ORIGIN_SZAMSZ05      -0.3140561  0.0067998   -46.186  < 2e-16 ***
ORIGIN_SZAMSZ06       0.0634425  0.0060258    10.528  < 2e-16 ***
ORIGIN_SZAMSZ07      -1.1301580  0.0110298  -102.464  < 2e-16 ***
ORIGIN_SZAMSZ08      -0.6330394  0.0102949   -61.491  < 2e-16 ***
ORIGIN_SZAMSZ09       0.1064915  0.0063450    16.784  < 2e-16 ***
ORIGIN_SZAMSZ10       0.5061899  0.0053889    93.931  < 2e-16 ***
ORIGIN_SZAMSZ11      -1.3167911  0.0144870   -90.895  < 2e-16 ***
ORIGIN_SZAMSZ12      -1.5103004  0.0127453  -118.499  < 2e-16 ***
ORIGIN_SZBDSZ01       1.3626004  0.0051433   264.929  < 2e-16 ***
ORIGIN_SZBDSZ02       0.9554084  0.0059655   160.156  < 2e-16 ***
ORIGIN_SZBDSZ03       1.1476190  0.0054278   211.433  < 2e-16 ***
ORIGIN_SZBDSZ04       2.0110410  0.0046344   433.940  < 2e-16 ***
ORIGIN_SZBDSZ05       1.0658940  0.0053976   197.477  < 2e-16 ***
ORIGIN_SZBDSZ06       1.2719222  0.0054774   232.213  < 2e-16 ***
ORIGIN_SZBDSZ07      -0.5053039  0.0111553   -45.297  < 2e-16 ***
ORIGIN_SZBDSZ08      -0.3556193  0.0102947   -34.544  < 2e-16 ***
ORIGIN_SZBKSZ01      -0.3606399  0.0075473   -47.784  < 2e-16 ***
ORIGIN_SZBKSZ02       0.1357265  0.0061394    22.107  < 2e-16 ***
ORIGIN_SZBKSZ03       0.4101999  0.0058983    69.545  < 2e-16 ***
ORIGIN_SZBKSZ04      -0.3418645  0.0070764   -48.310  < 2e-16 ***
ORIGIN_SZBKSZ05      -0.2986750  0.0074073   -40.322  < 2e-16 ***
ORIGIN_SZBKSZ06      -0.2637855  0.0068739   -38.375  < 2e-16 ***
ORIGIN_SZBKSZ07       0.5498323  0.0051476   106.813  < 2e-16 ***
ORIGIN_SZBKSZ08      -0.0527393  0.0061457    -8.582  < 2e-16 ***
ORIGIN_SZBKSZ09      -0.1564691  0.0067300   -23.249  < 2e-16 ***
ORIGIN_SZBLSZ01      -1.7551329  0.0176599   -99.385  < 2e-16 ***
ORIGIN_SZBLSZ02      -1.9493637  0.0213859   -91.152  < 2e-16 ***
ORIGIN_SZBLSZ03      -2.9057732  0.0535995   -54.213  < 2e-16 ***
ORIGIN_SZBLSZ04      -1.4672066  0.0254726   -57.599  < 2e-16 ***
ORIGIN_SZBMSZ01       0.1806064  0.0060563    29.821  < 2e-16 ***
ORIGIN_SZBMSZ02      -1.4026549  0.0078244  -179.267  < 2e-16 ***
ORIGIN_SZBMSZ03      -0.5976236  0.0063808   -93.660  < 2e-16 ***
ORIGIN_SZBMSZ04      -0.5456513  0.0059061   -92.388  < 2e-16 ***
ORIGIN_SZBMSZ05      -3.1095195  0.0188118  -165.297  < 2e-16 ***
ORIGIN_SZBMSZ06      -3.0273827  0.0194319  -155.794  < 2e-16 ***
ORIGIN_SZBMSZ07      -0.7378197  0.0066865  -110.345  < 2e-16 ***
ORIGIN_SZBMSZ08      -0.9306150  0.0067188  -138.510  < 2e-16 ***
ORIGIN_SZBMSZ09      -1.4137345  0.0101071  -139.876  < 2e-16 ***
ORIGIN_SZBMSZ10      -1.7054195  0.0101582  -167.886  < 2e-16 ***
ORIGIN_SZBMSZ11      -1.2418380  0.0076792  -161.714  < 2e-16 ***
ORIGIN_SZBMSZ12      -1.3746537  0.0109769  -125.231  < 2e-16 ***
ORIGIN_SZBMSZ13      -0.4339494  0.0069335   -62.587  < 2e-16 ***
ORIGIN_SZBMSZ14      -0.9950458  0.0076302  -130.410  < 2e-16 ***
ORIGIN_SZBMSZ15      -0.6544196  0.0068964   -94.892  < 2e-16 ***
ORIGIN_SZBMSZ16      -1.5193747  0.0105329  -144.250  < 2e-16 ***
ORIGIN_SZBMSZ17      -1.6536771  0.0180672   -91.529  < 2e-16 ***
ORIGIN_SZBPSZ01       0.1484355  0.0064734    22.930  < 2e-16 ***
ORIGIN_SZBPSZ02      -0.3602094  0.0073902   -48.741  < 2e-16 ***
ORIGIN_SZBPSZ03      -0.1567975  0.0072226   -21.709  < 2e-16 ***
ORIGIN_SZBPSZ04       0.4504873  0.0058418    77.115  < 2e-16 ***
ORIGIN_SZBPSZ05       0.5028646  0.0053682    93.675  < 2e-16 ***
ORIGIN_SZBPSZ06      -1.0125668  0.0105638   -95.853  < 2e-16 ***
ORIGIN_SZBPSZ07      -0.3859065  0.0098561   -39.154  < 2e-16 ***
ORIGIN_SZBSSZ01       0.1488497  0.0065504    22.724  < 2e-16 ***
ORIGIN_SZBSSZ02       0.4269498  0.0055893    76.387  < 2e-16 ***
ORIGIN_SZBSSZ03      -0.2437385  0.0062020   -39.300  < 2e-16 ***
ORIGIN_SZBTSZ01       0.1987940  0.0066672    29.817  < 2e-16 ***
ORIGIN_SZBTSZ02      -0.4571546  0.0090784   -50.356  < 2e-16 ***
ORIGIN_SZBTSZ03      -0.2697243  0.0077941   -34.606  < 2e-16 ***
ORIGIN_SZBTSZ04      -1.0997236  0.0115225   -95.441  < 2e-16 ***
ORIGIN_SZBTSZ05      -1.0053122  0.0132594   -75.819  < 2e-16 ***
ORIGIN_SZBTSZ06      -1.0841201  0.0102242  -106.035  < 2e-16 ***
ORIGIN_SZBTSZ07      -2.3134497  0.0158499  -145.960  < 2e-16 ***
ORIGIN_SZBTSZ08      -1.1581618  0.0121161   -95.589  < 2e-16 ***
ORIGIN_SZCBSZ01      -1.0805930  0.0577831   -18.701  < 2e-16 ***
ORIGIN_SZCCSZ01      -0.8145372  0.0152638   -53.364  < 2e-16 ***
ORIGIN_SZCHSZ01       0.0377079  0.0133240     2.830 0.004654 ** 
ORIGIN_SZCHSZ02      -0.6209553  0.0096388   -64.422  < 2e-16 ***
ORIGIN_SZCHSZ03       1.6790244  0.0069559   241.381  < 2e-16 ***
ORIGIN_SZCKSZ01       0.0839586  0.0059934    14.008  < 2e-16 ***
ORIGIN_SZCKSZ02       0.4379511  0.0062289    70.309  < 2e-16 ***
ORIGIN_SZCKSZ03       0.7956950  0.0051892   153.335  < 2e-16 ***
ORIGIN_SZCKSZ04       1.2740323  0.0053165   239.637  < 2e-16 ***
ORIGIN_SZCKSZ05       0.9326213  0.0061807   150.893  < 2e-16 ***
ORIGIN_SZCKSZ06       0.3976273  0.0085639    46.431  < 2e-16 ***
ORIGIN_SZCLSZ01      -0.7522917  0.0094655   -79.477  < 2e-16 ***
ORIGIN_SZCLSZ02      -1.3937450  0.0153260   -90.940  < 2e-16 ***
ORIGIN_SZCLSZ03      -0.7898683  0.0091016   -86.784  < 2e-16 ***
ORIGIN_SZCLSZ04       0.8451512  0.0051258   164.882  < 2e-16 ***
ORIGIN_SZCLSZ05      -1.6573818  0.0166091   -99.788  < 2e-16 ***
ORIGIN_SZCLSZ06       0.9478181  0.0048182   196.716  < 2e-16 ***
ORIGIN_SZCLSZ07      -0.2499753  0.0064632   -38.677  < 2e-16 ***
ORIGIN_SZCLSZ08       0.1350119  0.0069296    19.483  < 2e-16 ***
ORIGIN_SZCLSZ09      -1.3868782  0.0192743   -71.955  < 2e-16 ***
ORIGIN_SZDTSZ02      -3.7535792  0.0871325   -43.079  < 2e-16 ***
ORIGIN_SZDTSZ03      -3.8462041  0.0840156   -45.780  < 2e-16 ***
ORIGIN_SZDTSZ13      -2.9738127  0.0349241   -85.151  < 2e-16 ***
ORIGIN_SZGLSZ01      -1.5175198  0.0110135  -137.787  < 2e-16 ***
ORIGIN_SZGLSZ02       0.2405712  0.0058742    40.954  < 2e-16 ***
ORIGIN_SZGLSZ03       0.1940241  0.0061989    31.300  < 2e-16 ***
ORIGIN_SZGLSZ04       1.0292572  0.0049028   209.931  < 2e-16 ***
ORIGIN_SZGLSZ05       0.9864552  0.0050898   193.811  < 2e-16 ***
ORIGIN_SZHGSZ01       0.3073609  0.0054307    56.597  < 2e-16 ***
ORIGIN_SZHGSZ02       0.3827293  0.0054555    70.154  < 2e-16 ***
ORIGIN_SZHGSZ03       0.2342580  0.0059240    39.544  < 2e-16 ***
ORIGIN_SZHGSZ04       0.8750090  0.0049639   176.275  < 2e-16 ***
ORIGIN_SZHGSZ05       1.1695280  0.0049468   236.420  < 2e-16 ***
ORIGIN_SZHGSZ06      -0.0462411  0.0063805    -7.247 4.25e-13 ***
ORIGIN_SZHGSZ07       0.4488583  0.0055139    81.404  < 2e-16 ***
ORIGIN_SZHGSZ08       0.2236095  0.0061279    36.490  < 2e-16 ***
ORIGIN_SZHGSZ09      -1.6376674  0.0084442  -193.941  < 2e-16 ***
ORIGIN_SZHGSZ10      -2.9849025  0.0501042   -59.574  < 2e-16 ***
ORIGIN_SZJESZ01       0.3926525  0.0056268    69.783  < 2e-16 ***
ORIGIN_SZJESZ02       0.1230160  0.0056864    21.633  < 2e-16 ***
ORIGIN_SZJESZ03       0.0188276  0.0061020     3.085 0.002032 ** 
ORIGIN_SZJESZ04      -1.3611618  0.0117184  -116.156  < 2e-16 ***
ORIGIN_SZJESZ05      -2.0643662  0.0157083  -131.419  < 2e-16 ***
ORIGIN_SZJESZ06       0.1556368  0.0055245    28.172  < 2e-16 ***
ORIGIN_SZJESZ07      -1.7664532  0.0133171  -132.646  < 2e-16 ***
ORIGIN_SZJESZ08      -0.9115981  0.0138203   -65.961  < 2e-16 ***
ORIGIN_SZJESZ09       0.6121916  0.0060381   101.388  < 2e-16 ***
ORIGIN_SZJESZ10      -1.1953045  0.0233216   -51.253  < 2e-16 ***
ORIGIN_SZJESZ11      -1.4088748  0.0220921   -63.773  < 2e-16 ***
ORIGIN_SZJWSZ01       0.5759093  0.0077741    74.081  < 2e-16 ***
ORIGIN_SZJWSZ02       0.9769314  0.0053029   184.227  < 2e-16 ***
ORIGIN_SZJWSZ03       1.3242695  0.0049068   269.882  < 2e-16 ***
ORIGIN_SZJWSZ04       0.5621088  0.0057831    97.199  < 2e-16 ***
ORIGIN_SZJWSZ05      -1.5744341  0.0146904  -107.174  < 2e-16 ***
ORIGIN_SZJWSZ06      -0.9113320  0.0126913   -71.807  < 2e-16 ***
ORIGIN_SZJWSZ07      -2.3083419  0.0357843   -64.507  < 2e-16 ***
ORIGIN_SZJWSZ08       2.0114225  0.0047956   419.429  < 2e-16 ***
ORIGIN_SZJWSZ09       1.9086705  0.0045255   421.759  < 2e-16 ***
ORIGIN_SZKLSZ01       0.2743166  0.0056908    48.204  < 2e-16 ***
ORIGIN_SZKLSZ02      -0.6443386  0.0074521   -86.463  < 2e-16 ***
ORIGIN_SZKLSZ03      -0.3990113  0.0067213   -59.366  < 2e-16 ***
ORIGIN_SZKLSZ04      -2.1413876  0.0138405  -154.719  < 2e-16 ***
ORIGIN_SZKLSZ05      -1.0913697  0.0121512   -89.816  < 2e-16 ***
ORIGIN_SZKLSZ06      -5.6240764  0.1857405   -30.279  < 2e-16 ***
ORIGIN_SZKLSZ07      -1.1885897  0.0096830  -122.750  < 2e-16 ***
ORIGIN_SZKLSZ08      -1.7018593  0.0114317  -148.872  < 2e-16 ***
ORIGIN_SZLKSZ01      -1.6659670  0.0446420   -37.318  < 2e-16 ***
ORIGIN_SZMDSZ01      -1.1210505  0.0318834   -35.161  < 2e-16 ***
ORIGIN_SZMDSZ02      -0.5096299  0.0116645   -43.691  < 2e-16 ***
ORIGIN_SZMDSZ03      -1.9187039  0.0198291   -96.762  < 2e-16 ***
ORIGIN_SZMPSZ01      -0.5260512  0.0094201   -55.844  < 2e-16 ***
ORIGIN_SZMPSZ02      -0.2905084  0.0077974   -37.257  < 2e-16 ***
ORIGIN_SZMPSZ03       0.3342293  0.0063715    52.457  < 2e-16 ***
ORIGIN_SZMUSZ02      -3.8337096  0.1105053   -34.693  < 2e-16 ***
ORIGIN_SZNTSZ01      -2.9845040  0.0397028   -75.171  < 2e-16 ***
ORIGIN_SZNTSZ02      -3.1812985  0.0249470  -127.522  < 2e-16 ***
ORIGIN_SZNTSZ03      -0.9742991  0.0085424  -114.054  < 2e-16 ***
ORIGIN_SZNTSZ05      -4.2086932  0.0579737   -72.597  < 2e-16 ***
ORIGIN_SZNTSZ06      -4.5831822  0.0583494   -78.547  < 2e-16 ***
ORIGIN_SZNVSZ01       0.3186962  0.0052944    60.195  < 2e-16 ***
ORIGIN_SZNVSZ02      -0.5321136  0.0073747   -72.154  < 2e-16 ***
ORIGIN_SZNVSZ03      -0.9911852  0.0090560  -109.451  < 2e-16 ***
ORIGIN_SZNVSZ04      -0.8329721  0.0099590   -83.640  < 2e-16 ***
ORIGIN_SZNVSZ05      -2.1460777  0.0182401  -117.657  < 2e-16 ***
ORIGIN_SZPGSZ01      -0.5604078  0.0151515   -36.987  < 2e-16 ***
ORIGIN_SZPGSZ02      -0.4025139  0.0085135   -47.279  < 2e-16 ***
ORIGIN_SZPGSZ03       0.6975483  0.0055534   125.608  < 2e-16 ***
ORIGIN_SZPGSZ04       1.2175486  0.0051080   238.363  < 2e-16 ***
ORIGIN_SZPGSZ05       0.3895354  0.0069851    55.767  < 2e-16 ***
ORIGIN_SZPLSZ01      -0.5572701  0.0134473   -41.441  < 2e-16 ***
ORIGIN_SZPLSZ02      -0.9854214  0.0172337   -57.180  < 2e-16 ***
ORIGIN_SZPLSZ03      -1.6991954  0.0472629   -35.952  < 2e-16 ***
ORIGIN_SZPLSZ04      -2.2000217  0.0373580   -58.890  < 2e-16 ***
ORIGIN_SZPLSZ05      -1.7086663  0.0260920   -65.486  < 2e-16 ***
ORIGIN_SZPNSZ01       1.5292867  0.0055102   277.535  < 2e-16 ***
ORIGIN_SZPNSZ02       0.7457519  0.0127815    58.346  < 2e-16 ***
ORIGIN_SZPNSZ03      -1.3659046  0.0216180   -63.184  < 2e-16 ***
ORIGIN_SZPNSZ04      -2.0025379  0.0360655   -55.525  < 2e-16 ***
ORIGIN_SZPNSZ05      -0.9157959  0.0320955   -28.533  < 2e-16 ***
ORIGIN_SZPRSZ01       0.0522611  0.0139142     3.756 0.000173 ***
ORIGIN_SZPRSZ02       1.3063371  0.0053809   242.774  < 2e-16 ***
ORIGIN_SZPRSZ03       0.9963670  0.0054293   183.516  < 2e-16 ***
ORIGIN_SZPRSZ04      -0.0300950  0.0088010    -3.419 0.000627 ***
ORIGIN_SZPRSZ05       1.6840313  0.0050839   331.245  < 2e-16 ***
ORIGIN_SZPRSZ06      -0.8277202  0.0131296   -63.042  < 2e-16 ***
ORIGIN_SZPRSZ07      -2.1698449  0.0177362  -122.340  < 2e-16 ***
ORIGIN_SZPRSZ08       0.4559353  0.0072609    62.793  < 2e-16 ***
ORIGIN_SZQTSZ01      -0.3517047  0.0078770   -44.650  < 2e-16 ***
ORIGIN_SZQTSZ02      -0.8199353  0.0071544  -114.605  < 2e-16 ***
ORIGIN_SZQTSZ03      -0.2457614  0.0065555   -37.490  < 2e-16 ***
ORIGIN_SZQTSZ04      -1.2216614  0.0084050  -145.349  < 2e-16 ***
ORIGIN_SZQTSZ05      -0.7219952  0.0072360   -99.778  < 2e-16 ***
ORIGIN_SZQTSZ06      -0.6729363  0.0076658   -87.784  < 2e-16 ***
ORIGIN_SZQTSZ07      -1.4497690  0.0109365  -132.563  < 2e-16 ***
ORIGIN_SZQTSZ08      -0.2770151  0.0070193   -39.465  < 2e-16 ***
ORIGIN_SZQTSZ09      -0.6157554  0.0078739   -78.202  < 2e-16 ***
ORIGIN_SZQTSZ10      -0.3091547  0.0075471   -40.963  < 2e-16 ***
ORIGIN_SZQTSZ11      -1.9698881  0.0151247  -130.243  < 2e-16 ***
ORIGIN_SZQTSZ12      -2.6449643  0.0205857  -128.485  < 2e-16 ***
ORIGIN_SZQTSZ13      -0.3754107  0.0088433   -42.452  < 2e-16 ***
ORIGIN_SZQTSZ14      -1.6537473  0.0134378  -123.067  < 2e-16 ***
ORIGIN_SZQTSZ15      -0.3435351  0.0131956   -26.034  < 2e-16 ***
ORIGIN_SZRCSZ01      -1.7104390  0.0141179  -121.154  < 2e-16 ***
ORIGIN_SZRCSZ06      -1.1250727  0.0094909  -118.542  < 2e-16 ***
ORIGIN_SZRVSZ01      -3.0220116  0.0339694   -88.963  < 2e-16 ***
ORIGIN_SZRVSZ02      -3.6040075  0.0297641  -121.086  < 2e-16 ***
ORIGIN_SZRVSZ03      -3.2345594  0.0259149  -124.814  < 2e-16 ***
ORIGIN_SZRVSZ04      -3.6900313  0.0575908   -64.073  < 2e-16 ***
ORIGIN_SZRVSZ05      -2.9527570  0.0178582  -165.344  < 2e-16 ***
ORIGIN_SZSBSZ01       0.0238445  0.0078563     3.035 0.002405 ** 
ORIGIN_SZSBSZ02      -0.5780602  0.0093054   -62.121  < 2e-16 ***
ORIGIN_SZSBSZ03       0.8961719  0.0054586   164.175  < 2e-16 ***
ORIGIN_SZSBSZ04       0.8421798  0.0061888   136.080  < 2e-16 ***
ORIGIN_SZSBSZ05      -0.1682984  0.0078342   -21.482  < 2e-16 ***
ORIGIN_SZSBSZ06      -1.1482701  0.0196421   -58.460  < 2e-16 ***
ORIGIN_SZSBSZ07      -0.8830317  0.0160709   -54.946  < 2e-16 ***
ORIGIN_SZSBSZ08      -1.1039492  0.0174602   -63.226  < 2e-16 ***
ORIGIN_SZSBSZ09      -0.5946691  0.0101961   -58.323  < 2e-16 ***
ORIGIN_SZSESZ02       1.1144933  0.0050948   218.749  < 2e-16 ***
ORIGIN_SZSESZ03       1.1058963  0.0049026   225.574  < 2e-16 ***
ORIGIN_SZSESZ04       0.7427975  0.0056948   130.433  < 2e-16 ***
ORIGIN_SZSESZ05      -0.2812684  0.0069596   -40.414  < 2e-16 ***
ORIGIN_SZSESZ06       0.8168315  0.0055800   146.387  < 2e-16 ***
ORIGIN_SZSESZ07      -2.2842043  0.0231232   -98.784  < 2e-16 ***
ORIGIN_SZSGSZ01      -0.7313790  0.0098957   -73.909  < 2e-16 ***
ORIGIN_SZSGSZ02      -1.1185406  0.0110919  -100.843  < 2e-16 ***
ORIGIN_SZSGSZ03       0.1752618  0.0060508    28.965  < 2e-16 ***
ORIGIN_SZSGSZ04       0.3764395  0.0056165    67.023  < 2e-16 ***
ORIGIN_SZSGSZ05      -1.7203916  0.0118945  -144.637  < 2e-16 ***
ORIGIN_SZSGSZ06       0.4630857  0.0052886    87.563  < 2e-16 ***
ORIGIN_SZSGSZ07      -0.7051233  0.0073133   -96.417  < 2e-16 ***
ORIGIN_SZSKSZ01       0.2053928  0.0100710    20.395  < 2e-16 ***
ORIGIN_SZSKSZ02       1.2630428  0.0063490   198.935  < 2e-16 ***
ORIGIN_SZSKSZ03      -0.3035297  0.0096788   -31.360  < 2e-16 ***
ORIGIN_SZSKSZ04      -1.7952886  0.0359225   -49.977  < 2e-16 ***
ORIGIN_SZSKSZ05      -0.3836861  0.0176686   -21.716  < 2e-16 ***
ORIGIN_SZSLSZ01      -2.5916326  0.0348001   -74.472  < 2e-16 ***
ORIGIN_SZSLSZ04      -0.2251549  0.0088517   -25.436  < 2e-16 ***
ORIGIN_SZSRSZ01      -2.9590365  0.0173638  -170.414  < 2e-16 ***
ORIGIN_SZTHSZ01      -1.9639893  0.0570321   -34.437  < 2e-16 ***
ORIGIN_SZTHSZ03      -1.7281304  0.0272797   -63.349  < 2e-16 ***
ORIGIN_SZTHSZ04      -2.7837906  0.0343179   -81.118  < 2e-16 ***
ORIGIN_SZTHSZ06      -2.1800693  0.0205491  -106.091  < 2e-16 ***
ORIGIN_SZTMSZ01       0.8228136  0.0066824   123.131  < 2e-16 ***
ORIGIN_SZTMSZ02       2.3174781  0.0044978   515.243  < 2e-16 ***
ORIGIN_SZTMSZ03       1.7061757  0.0048615   350.957  < 2e-16 ***
ORIGIN_SZTMSZ04       1.2407899  0.0058389   212.504  < 2e-16 ***
ORIGIN_SZTMSZ05      -0.1000526  0.0124079    -8.064 7.41e-16 ***
ORIGIN_SZTNSZ01      -2.0347519  0.0139596  -145.760  < 2e-16 ***
ORIGIN_SZTNSZ02      -1.8682671  0.0107901  -173.146  < 2e-16 ***
ORIGIN_SZTNSZ03      -2.1737183  0.0146759  -148.115  < 2e-16 ***
ORIGIN_SZTNSZ04      -0.5006452  0.0081501   -61.428  < 2e-16 ***
ORIGIN_SZTPSZ01      -0.6722487  0.0075606   -88.914  < 2e-16 ***
ORIGIN_SZTPSZ02       0.4552916  0.0050191    90.711  < 2e-16 ***
ORIGIN_SZTPSZ03      -0.7865781  0.0072250  -108.869  < 2e-16 ***
ORIGIN_SZTPSZ04      -0.7049044  0.0066456  -106.071  < 2e-16 ***
ORIGIN_SZTPSZ05      -0.5574925  0.0070366   -79.227  < 2e-16 ***
ORIGIN_SZTPSZ06      -0.4247282  0.0068709   -61.815  < 2e-16 ***
ORIGIN_SZTPSZ07      -0.2846984  0.0071030   -40.081  < 2e-16 ***
ORIGIN_SZTPSZ08      -1.0898051  0.0110046   -99.031  < 2e-16 ***
ORIGIN_SZTPSZ09      -0.8092746  0.0079160  -102.232  < 2e-16 ***
ORIGIN_SZTPSZ10      -0.9332072  0.0086809  -107.502  < 2e-16 ***
ORIGIN_SZTPSZ11      -0.0421981  0.0064343    -6.558 5.44e-11 ***
ORIGIN_SZTPSZ12      -0.6330081  0.0078324   -80.819  < 2e-16 ***
ORIGIN_SZTSSZ01      -1.7650409  0.0517357   -34.116  < 2e-16 ***
ORIGIN_SZTSSZ02       1.1707267  0.0094178   124.310  < 2e-16 ***
ORIGIN_SZTSSZ03       0.6581679  0.0095894    68.635  < 2e-16 ***
ORIGIN_SZTSSZ04       0.8736493  0.0104965    83.233  < 2e-16 ***
ORIGIN_SZTSSZ05       0.0957248  0.0178709     5.356 8.49e-08 ***
ORIGIN_SZTSSZ06       1.7581609  0.0206810    85.013  < 2e-16 ***
ORIGIN_SZWCSZ01       0.8097950  0.0105622    76.669  < 2e-16 ***
ORIGIN_SZWCSZ02      -1.9966163  0.0345747   -57.748  < 2e-16 ***
ORIGIN_SZWCSZ03      -5.0687420  0.1474971   -34.365  < 2e-16 ***
ORIGIN_SZWDSZ01       1.4926003  0.0047216   316.124  < 2e-16 ***
ORIGIN_SZWDSZ02       0.9916597  0.0055755   177.859  < 2e-16 ***
ORIGIN_SZWDSZ03       1.5918065  0.0052180   305.062  < 2e-16 ***
ORIGIN_SZWDSZ04       1.3717152  0.0060516   226.669  < 2e-16 ***
ORIGIN_SZWDSZ05       0.6700111  0.0062287   107.569  < 2e-16 ***
ORIGIN_SZWDSZ06       0.8115996  0.0060947   133.165  < 2e-16 ***
ORIGIN_SZWDSZ07      -0.6488914  0.0093567   -69.351  < 2e-16 ***
ORIGIN_SZWDSZ08      -0.3610234  0.0096440   -37.435  < 2e-16 ***
ORIGIN_SZWDSZ09       1.4445461  0.0052279   276.317  < 2e-16 ***
ORIGIN_SZYSSZ01      -0.2039272  0.0069548   -29.322  < 2e-16 ***
ORIGIN_SZYSSZ02       0.8707707  0.0058957   147.697  < 2e-16 ***
ORIGIN_SZYSSZ03       1.8348842  0.0050377   364.231  < 2e-16 ***
ORIGIN_SZYSSZ04       1.0780641  0.0052960   203.564  < 2e-16 ***
ORIGIN_SZYSSZ05       0.3222765  0.0069700    46.237  < 2e-16 ***
ORIGIN_SZYSSZ06      -0.4424689  0.0124866   -35.435  < 2e-16 ***
ORIGIN_SZYSSZ07      -1.0267883  0.0155821   -65.895  < 2e-16 ***
ORIGIN_SZYSSZ08       0.1833117  0.0070935    25.842  < 2e-16 ***
ORIGIN_SZYSSZ09       1.0766070  0.0050451   213.396  < 2e-16 ***
log(DESTIN_AGE25_64)  0.0295428  0.0001051   280.998  < 2e-16 ***
log(dist)            -1.7024691  0.0004625 -3681.042  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 36117615  on 14273  degrees of freedom
Residual deviance: 12983718  on 13993  degrees of freedom
AIC: 13068835

Number of Fisher Scoring iterations: 6

We can examine how the constraints hold for destinations this time.

CalcRSquared(orcSIM$data$TRIPS, orcSIM$fitted.values)
[1] 0.4029115

16.13.7 Destination constrained

In this section, we will fit a destination constrained SIM by using the code chunk below.

The general formula of Destination Constrained Spatial Interaction Model

decSIM <- glm(formula = TRIPS ~ 
                DESTIN_SZ + 
                log(ORIGIN_AGE25_64) + 
                log(dist),
              family = poisson(link = "log"),
              data = SIM_data,
              na.action = na.exclude)
summary(decSIM)

Call:
glm(formula = TRIPS ~ DESTIN_SZ + log(ORIGIN_AGE25_64) + log(dist), 
    family = poisson(link = "log"), data = SIM_data, na.action = na.exclude)

Coefficients:
                       Estimate Std. Error   z value Pr(>|z|)    
(Intercept)          19.4822997  0.0050784  3836.298  < 2e-16 ***
DESTIN_SZAMSZ02       0.1263056  0.0049743    25.392  < 2e-16 ***
DESTIN_SZAMSZ03       0.0421788  0.0049859     8.460  < 2e-16 ***
DESTIN_SZAMSZ04      -1.1668479  0.0074254  -157.143  < 2e-16 ***
DESTIN_SZAMSZ05      -1.2586639  0.0075854  -165.931  < 2e-16 ***
DESTIN_SZAMSZ06      -1.1414791  0.0073474  -155.359  < 2e-16 ***
DESTIN_SZAMSZ07      -1.5565804  0.0109476  -142.185  < 2e-16 ***
DESTIN_SZAMSZ08      -0.3990754  0.0074159   -53.813  < 2e-16 ***
DESTIN_SZAMSZ09      -1.0109118  0.0076802  -131.626  < 2e-16 ***
DESTIN_SZAMSZ10       0.0159285  0.0051765     3.077  0.00209 ** 
DESTIN_SZAMSZ11      -0.3653273  0.0094866   -38.510  < 2e-16 ***
DESTIN_SZAMSZ12       0.5297606  0.0053243    99.500  < 2e-16 ***
DESTIN_SZBDSZ01       1.0394822  0.0044226   235.037  < 2e-16 ***
DESTIN_SZBDSZ02       0.1956964  0.0059564    32.855  < 2e-16 ***
DESTIN_SZBDSZ03       0.3209267  0.0053718    59.742  < 2e-16 ***
DESTIN_SZBDSZ04       1.2429874  0.0043104   288.370  < 2e-16 ***
DESTIN_SZBDSZ05       0.8535842  0.0046360   184.122  < 2e-16 ***
DESTIN_SZBDSZ06       0.5181443  0.0053736    96.423  < 2e-16 ***
DESTIN_SZBDSZ07      -0.5849371  0.0110468   -52.951  < 2e-16 ***
DESTIN_SZBDSZ08      -1.2871050  0.0128623  -100.068  < 2e-16 ***
DESTIN_SZBKSZ01      -1.0633560  0.0077771  -136.730  < 2e-16 ***
DESTIN_SZBKSZ02      -0.4065316  0.0066712   -60.938  < 2e-16 ***
DESTIN_SZBKSZ03      -0.6815674  0.0066509  -102.477  < 2e-16 ***
DESTIN_SZBKSZ04      -0.4185485  0.0058306   -71.785  < 2e-16 ***
DESTIN_SZBKSZ05      -0.8887654  0.0073867  -120.319  < 2e-16 ***
DESTIN_SZBKSZ06      -0.9436078  0.0068625  -137.501  < 2e-16 ***
DESTIN_SZBKSZ07      -0.0067325  0.0048408    -1.391  0.16430    
DESTIN_SZBKSZ08      -1.2680903  0.0079177  -160.160  < 2e-16 ***
DESTIN_SZBKSZ09      -0.0350151  0.0054287    -6.450 1.12e-10 ***
DESTIN_SZBLSZ01      -0.3045203  0.0081978   -37.146  < 2e-16 ***
DESTIN_SZBLSZ02       0.6432424  0.0074449    86.400  < 2e-16 ***
DESTIN_SZBLSZ03       1.9595113  0.0084705   231.333  < 2e-16 ***
DESTIN_SZBLSZ04       0.0149756  0.0172081     0.870  0.38415    
DESTIN_SZBMSZ01      -0.0378127  0.0055294    -6.838 8.00e-12 ***
DESTIN_SZBMSZ02      -0.8458055  0.0054043  -156.505  < 2e-16 ***
DESTIN_SZBMSZ03      -1.1334399  0.0063720  -177.878  < 2e-16 ***
DESTIN_SZBMSZ04      -1.1164759  0.0057743  -193.353  < 2e-16 ***
DESTIN_SZBMSZ05      -1.1078742  0.0078703  -140.766  < 2e-16 ***
DESTIN_SZBMSZ06      -2.2787234  0.0155126  -146.895  < 2e-16 ***
DESTIN_SZBMSZ07      -0.2739089  0.0051924   -52.752  < 2e-16 ***
DESTIN_SZBMSZ08      -1.6825978  0.0071842  -234.209  < 2e-16 ***
DESTIN_SZBMSZ09      -3.0047801  0.0159980  -187.823  < 2e-16 ***
DESTIN_SZBMSZ10      -2.2232689  0.0096907  -229.423  < 2e-16 ***
DESTIN_SZBMSZ11      -1.9657136  0.0086445  -227.394  < 2e-16 ***
DESTIN_SZBMSZ12      -1.5359286  0.0089658  -171.310  < 2e-16 ***
DESTIN_SZBMSZ13      -0.5657561  0.0059960   -94.355  < 2e-16 ***
DESTIN_SZBMSZ14      -1.6904858  0.0084858  -199.214  < 2e-16 ***
DESTIN_SZBMSZ15      -1.5268383  0.0079959  -190.953  < 2e-16 ***
DESTIN_SZBMSZ16      -2.2045600  0.0130872  -168.452  < 2e-16 ***
DESTIN_SZBMSZ17      -2.2992381  0.0184895  -124.353  < 2e-16 ***
DESTIN_SZBPSZ01      -0.8549497  0.0065168  -131.191  < 2e-16 ***
DESTIN_SZBPSZ02      -1.7470549  0.0095751  -182.457  < 2e-16 ***
DESTIN_SZBPSZ03      -1.4015145  0.0090888  -154.203  < 2e-16 ***
DESTIN_SZBPSZ04      -0.5250632  0.0066496   -78.962  < 2e-16 ***
DESTIN_SZBPSZ05       0.3413171  0.0046404    73.553  < 2e-16 ***
DESTIN_SZBPSZ06      -0.8569188  0.0090795   -94.380  < 2e-16 ***
DESTIN_SZBPSZ07      -0.0751284  0.0089704    -8.375  < 2e-16 ***
DESTIN_SZBSSZ01       0.1015228  0.0055735    18.215  < 2e-16 ***
DESTIN_SZBSSZ02      -0.7066412  0.0063845  -110.682  < 2e-16 ***
DESTIN_SZBSSZ03       0.1622730  0.0046689    34.756  < 2e-16 ***
DESTIN_SZBTSZ01       0.5470615  0.0047984   114.009  < 2e-16 ***
DESTIN_SZBTSZ02      -0.1393371  0.0078266   -17.803  < 2e-16 ***
DESTIN_SZBTSZ03       0.1474771  0.0059428    24.816  < 2e-16 ***
DESTIN_SZBTSZ04      -1.2857827  0.0122000  -105.392  < 2e-16 ***
DESTIN_SZBTSZ05      -0.2629188  0.0081769   -32.154  < 2e-16 ***
DESTIN_SZBTSZ06      -0.8319920  0.0081401  -102.209  < 2e-16 ***
DESTIN_SZBTSZ07      -1.8829448  0.0121227  -155.324  < 2e-16 ***
DESTIN_SZBTSZ08      -1.5732123  0.0116752  -134.748  < 2e-16 ***
DESTIN_SZCBSZ01      -3.5334327  0.3333510   -10.600  < 2e-16 ***
DESTIN_SZCCSZ01      -0.2129306  0.0093782   -22.705  < 2e-16 ***
DESTIN_SZCHSZ01      -0.1494972  0.0113078   -13.221  < 2e-16 ***
DESTIN_SZCHSZ02       0.0041774  0.0063195     0.661  0.50860    
DESTIN_SZCHSZ03       2.5565450  0.0046495   549.857  < 2e-16 ***
DESTIN_SZCKSZ01       0.0489719  0.0053801     9.102  < 2e-16 ***
DESTIN_SZCKSZ02      -0.3548993  0.0060671   -58.496  < 2e-16 ***
DESTIN_SZCKSZ03       0.5386351  0.0044913   119.928  < 2e-16 ***
DESTIN_SZCKSZ04      -0.4425512  0.0073837   -59.936  < 2e-16 ***
DESTIN_SZCKSZ05      -0.4092591  0.0077267   -52.967  < 2e-16 ***
DESTIN_SZCKSZ06       0.2207041  0.0074252    29.724  < 2e-16 ***
DESTIN_SZCLSZ01       0.2851460  0.0052362    54.457  < 2e-16 ***
DESTIN_SZCLSZ02      -1.9270528  0.0147688  -130.482  < 2e-16 ***
DESTIN_SZCLSZ03      -0.6266521  0.0086780   -72.212  < 2e-16 ***
DESTIN_SZCLSZ04      -0.1335581  0.0054216   -24.634  < 2e-16 ***
DESTIN_SZCLSZ05      -0.8912963  0.0096015   -92.829  < 2e-16 ***
DESTIN_SZCLSZ06       0.1781234  0.0048150    36.993  < 2e-16 ***
DESTIN_SZCLSZ07      -0.5609619  0.0062277   -90.075  < 2e-16 ***
DESTIN_SZCLSZ08      -0.3875308  0.0068390   -56.665  < 2e-16 ***
DESTIN_SZCLSZ09       0.2539453  0.0072623    34.968  < 2e-16 ***
DESTIN_SZDTSZ02      -2.5036295  0.0373421   -67.046  < 2e-16 ***
DESTIN_SZDTSZ03      -0.8956407  0.0149971   -59.721  < 2e-16 ***
DESTIN_SZDTSZ13      -1.6562176  0.0175441   -94.403  < 2e-16 ***
DESTIN_SZGLSZ01      -0.2716152  0.0056553   -48.029  < 2e-16 ***
DESTIN_SZGLSZ02      -0.1735665  0.0055548   -31.246  < 2e-16 ***
DESTIN_SZGLSZ03       0.7029507  0.0044934   156.441  < 2e-16 ***
DESTIN_SZGLSZ04       0.5788027  0.0045449   127.351  < 2e-16 ***
DESTIN_SZGLSZ05       0.6865291  0.0045131   152.118  < 2e-16 ***
DESTIN_SZHGSZ01       0.3275950  0.0043866    74.681  < 2e-16 ***
DESTIN_SZHGSZ02      -0.6326974  0.0063517   -99.610  < 2e-16 ***
DESTIN_SZHGSZ03      -1.0597982  0.0073914  -143.382  < 2e-16 ***
DESTIN_SZHGSZ04      -0.2267013  0.0052178   -43.448  < 2e-16 ***
DESTIN_SZHGSZ05      -0.3063050  0.0055452   -55.238  < 2e-16 ***
DESTIN_SZHGSZ06      -0.7483961  0.0065544  -114.182  < 2e-16 ***
DESTIN_SZHGSZ07       0.1096958  0.0051309    21.379  < 2e-16 ***
DESTIN_SZHGSZ08      -0.1374201  0.0056692   -24.240  < 2e-16 ***
DESTIN_SZHGSZ09       0.0775400  0.0060230    12.874  < 2e-16 ***
DESTIN_SZHGSZ10      -3.3017475  0.0289292  -114.132  < 2e-16 ***
DESTIN_SZJESZ01      -0.0489065  0.0057246    -8.543  < 2e-16 ***
DESTIN_SZJESZ02      -0.5101614  0.0060074   -84.921  < 2e-16 ***
DESTIN_SZJESZ03      -0.5328921  0.0064129   -83.097  < 2e-16 ***
DESTIN_SZJESZ04      -0.7348953  0.0082249   -89.351  < 2e-16 ***
DESTIN_SZJESZ05      -1.0864570  0.0111740   -97.231  < 2e-16 ***
DESTIN_SZJESZ06       0.2407920  0.0046801    51.451  < 2e-16 ***
DESTIN_SZJESZ07      -1.1523093  0.0090103  -127.888  < 2e-16 ***
DESTIN_SZJESZ08      -0.4627356  0.0094529   -48.952  < 2e-16 ***
DESTIN_SZJESZ09       0.0528616  0.0068126     7.759 8.53e-15 ***
DESTIN_SZJESZ10       1.0240660  0.0084045   121.848  < 2e-16 ***
DESTIN_SZJESZ11       0.7875517  0.0076251   103.284  < 2e-16 ***
DESTIN_SZJWSZ01      -0.1533418  0.0076198   -20.124  < 2e-16 ***
DESTIN_SZJWSZ02      -0.0011019  0.0059389    -0.186  0.85280    
DESTIN_SZJWSZ03       0.9063789  0.0046747   193.892  < 2e-16 ***
DESTIN_SZJWSZ04       0.7019286  0.0049743   141.112  < 2e-16 ***
DESTIN_SZJWSZ05      -0.5197057  0.0072971   -71.220  < 2e-16 ***
DESTIN_SZJWSZ06       0.3350986  0.0061171    54.780  < 2e-16 ***
DESTIN_SZJWSZ07      -0.5961960  0.0328336   -18.158  < 2e-16 ***
DESTIN_SZJWSZ08       0.8054662  0.0056006   143.819  < 2e-16 ***
DESTIN_SZJWSZ09       1.5860146  0.0040282   393.723  < 2e-16 ***
DESTIN_SZKLSZ01      -0.6500838  0.0063560  -102.279  < 2e-16 ***
DESTIN_SZKLSZ02      -0.7039434  0.0064465  -109.197  < 2e-16 ***
DESTIN_SZKLSZ03      -1.1972384  0.0075577  -158.413  < 2e-16 ***
DESTIN_SZKLSZ04      -1.7172228  0.0097573  -175.993  < 2e-16 ***
DESTIN_SZKLSZ05      -0.6042386  0.0093730   -64.466  < 2e-16 ***
DESTIN_SZKLSZ06      -3.0201496  0.0389503   -77.539  < 2e-16 ***
DESTIN_SZKLSZ07      -1.1522413  0.0076607  -150.409  < 2e-16 ***
DESTIN_SZKLSZ08      -0.6977825  0.0057610  -121.122  < 2e-16 ***
DESTIN_SZLKSZ01      -0.6895952  0.0268661   -25.668  < 2e-16 ***
DESTIN_SZMDSZ01      -0.7155951  0.0228203   -31.358  < 2e-16 ***
DESTIN_SZMDSZ02      -0.8153643  0.0123003   -66.288  < 2e-16 ***
DESTIN_SZMDSZ03      -2.7745226  0.0301326   -92.077  < 2e-16 ***
DESTIN_SZMPSZ01      -0.5492095  0.0087198   -62.984  < 2e-16 ***
DESTIN_SZMPSZ02      -0.6104744  0.0069346   -88.033  < 2e-16 ***
DESTIN_SZMPSZ03       0.2775047  0.0054964    50.489  < 2e-16 ***
DESTIN_SZMUSZ02      -2.6322870  0.0214943  -122.464  < 2e-16 ***
DESTIN_SZNTSZ01      -4.0762008  0.0531046   -76.758  < 2e-16 ***
DESTIN_SZNTSZ02      -1.9765545  0.0125659  -157.296  < 2e-16 ***
DESTIN_SZNTSZ03      -1.4563069  0.0085433  -170.462  < 2e-16 ***
DESTIN_SZNTSZ05      -2.0125598  0.0270737   -74.336  < 2e-16 ***
DESTIN_SZNTSZ06      -3.0145357  0.0504986   -59.695  < 2e-16 ***
DESTIN_SZNVSZ01      -0.4693625  0.0053866   -87.135  < 2e-16 ***
DESTIN_SZNVSZ02      -0.4525631  0.0060428   -74.894  < 2e-16 ***
DESTIN_SZNVSZ03      -0.4821492  0.0064725   -74.492  < 2e-16 ***
DESTIN_SZNVSZ04      -1.8929756  0.0128397  -147.432  < 2e-16 ***
DESTIN_SZNVSZ05      -1.4501752  0.0099737  -145.400  < 2e-16 ***
DESTIN_SZPGSZ01      -1.2305867  0.0174321   -70.593  < 2e-16 ***
DESTIN_SZPGSZ02      -0.8232919  0.0080153  -102.715  < 2e-16 ***
DESTIN_SZPGSZ03       0.2138480  0.0050850    42.054  < 2e-16 ***
DESTIN_SZPGSZ04       0.1045757  0.0053579    19.518  < 2e-16 ***
DESTIN_SZPGSZ05      -0.7542450  0.0088883   -84.858  < 2e-16 ***
DESTIN_SZPLSZ01      -0.0098642  0.0080428    -1.226  0.22003    
DESTIN_SZPLSZ02      -1.2630412  0.0152594   -82.771  < 2e-16 ***
DESTIN_SZPLSZ03      -0.1554479  0.0108611   -14.312  < 2e-16 ***
DESTIN_SZPLSZ04      -1.5505819  0.0114768  -135.105  < 2e-16 ***
DESTIN_SZPLSZ05      -0.2417805  0.0130391   -18.543  < 2e-16 ***
DESTIN_SZPNSZ01       0.7926715  0.0073628   107.659  < 2e-16 ***
DESTIN_SZPNSZ02       2.1914920  0.0073537   298.013  < 2e-16 ***
DESTIN_SZPNSZ03       1.0246845  0.0086874   117.951  < 2e-16 ***
DESTIN_SZPNSZ04       2.5522612  0.0091789   278.057  < 2e-16 ***
DESTIN_SZPNSZ05       1.7995301  0.0138562   129.872  < 2e-16 ***
DESTIN_SZPRSZ01      -0.6576686  0.0096037   -68.481  < 2e-16 ***
DESTIN_SZPRSZ02       0.3113532  0.0059851    52.021  < 2e-16 ***
DESTIN_SZPRSZ03       0.9255296  0.0044779   206.687  < 2e-16 ***
DESTIN_SZPRSZ04      -0.0028578  0.0093218    -0.307  0.75917    
DESTIN_SZPRSZ05       0.2457863  0.0058261    42.187  < 2e-16 ***
DESTIN_SZPRSZ06       0.3692137  0.0064542    57.205  < 2e-16 ***
DESTIN_SZPRSZ07      -1.6733306  0.0138440  -120.871  < 2e-16 ***
DESTIN_SZPRSZ08      -0.2221048  0.0074846   -29.675  < 2e-16 ***
DESTIN_SZQTSZ01      -1.0185488  0.0093179  -109.311  < 2e-16 ***
DESTIN_SZQTSZ02      -1.2802688  0.0081670  -156.761  < 2e-16 ***
DESTIN_SZQTSZ03      -1.3322708  0.0079106  -168.415  < 2e-16 ***
DESTIN_SZQTSZ04      -1.1803631  0.0077366  -152.568  < 2e-16 ***
DESTIN_SZQTSZ05      -1.2215818  0.0072829  -167.734  < 2e-16 ***
DESTIN_SZQTSZ06      -1.3213145  0.0074858  -176.509  < 2e-16 ***
DESTIN_SZQTSZ07      -1.6426306  0.0123347  -133.171  < 2e-16 ***
DESTIN_SZQTSZ08      -0.2224169  0.0058405   -38.082  < 2e-16 ***
DESTIN_SZQTSZ09      -0.8142678  0.0069796  -116.665  < 2e-16 ***
DESTIN_SZQTSZ10      -0.1090496  0.0062573   -17.428  < 2e-16 ***
DESTIN_SZQTSZ11      -0.0108951  0.0061145    -1.782  0.07477 .  
DESTIN_SZQTSZ12      -0.8582515  0.0090243   -95.105  < 2e-16 ***
DESTIN_SZQTSZ13       0.1834409  0.0065231    28.122  < 2e-16 ***
DESTIN_SZQTSZ14       0.1994454  0.0073615    27.093  < 2e-16 ***
DESTIN_SZQTSZ15       0.6740197  0.0088699    75.990  < 2e-16 ***
DESTIN_SZRCSZ01      -0.7746427  0.0079375   -97.593  < 2e-16 ***
DESTIN_SZRCSZ06      -1.4394098  0.0209931   -68.566  < 2e-16 ***
DESTIN_SZRVSZ01      -2.6060495  0.0175759  -148.274  < 2e-16 ***
DESTIN_SZRVSZ02      -2.5823769  0.0354706   -72.803  < 2e-16 ***
DESTIN_SZRVSZ03      -2.5890601  0.0152644  -169.614  < 2e-16 ***
DESTIN_SZRVSZ04      -2.2277482  0.0165661  -134.477  < 2e-16 ***
DESTIN_SZRVSZ05      -3.8610445  0.0298251  -129.456  < 2e-16 ***
DESTIN_SZSBSZ01      -1.2035529  0.0103954  -115.777  < 2e-16 ***
DESTIN_SZSBSZ02      -1.0267199  0.0085239  -120.452  < 2e-16 ***
DESTIN_SZSBSZ03       0.5977382  0.0050336   118.750  < 2e-16 ***
DESTIN_SZSBSZ04       0.5362769  0.0060573    88.534  < 2e-16 ***
DESTIN_SZSBSZ05      -1.0440525  0.0089622  -116.495  < 2e-16 ***
DESTIN_SZSBSZ06      -1.3939595  0.0246679   -56.509  < 2e-16 ***
DESTIN_SZSBSZ07       0.1029116  0.0235414     4.372 1.23e-05 ***
DESTIN_SZSBSZ08       1.3564902  0.0060529   224.105  < 2e-16 ***
DESTIN_SZSBSZ09       0.4573712  0.0056585    80.829  < 2e-16 ***
DESTIN_SZSESZ02      -0.1553609  0.0056716   -27.393  < 2e-16 ***
DESTIN_SZSESZ03       0.5412776  0.0043801   123.576  < 2e-16 ***
DESTIN_SZSESZ04      -0.6382091  0.0065411   -97.568  < 2e-16 ***
DESTIN_SZSESZ05      -0.3332093  0.0055002   -60.581  < 2e-16 ***
DESTIN_SZSESZ06      -0.3085951  0.0072340   -42.659  < 2e-16 ***
DESTIN_SZSESZ07      -2.6237684  0.0245753  -106.764  < 2e-16 ***
DESTIN_SZSGSZ01      -0.1062372  0.0066634   -15.943  < 2e-16 ***
DESTIN_SZSGSZ02      -0.0475568  0.0058908    -8.073 6.85e-16 ***
DESTIN_SZSGSZ03      -0.2118402  0.0055056   -38.477  < 2e-16 ***
DESTIN_SZSGSZ04      -0.1099618  0.0054841   -20.051  < 2e-16 ***
DESTIN_SZSGSZ05      -2.1556963  0.0113821  -189.394  < 2e-16 ***
DESTIN_SZSGSZ06       0.4416352  0.0043842   100.734  < 2e-16 ***
DESTIN_SZSGSZ07      -0.3949335  0.0059250   -66.655  < 2e-16 ***
DESTIN_SZSISZ01      -1.2847094  0.0288610   -44.514  < 2e-16 ***
DESTIN_SZSKSZ01       0.3089834  0.0082924    37.261  < 2e-16 ***
DESTIN_SZSKSZ02       1.4139309  0.0059981   235.729  < 2e-16 ***
DESTIN_SZSKSZ03       0.2427688  0.0067373    36.034  < 2e-16 ***
DESTIN_SZSKSZ04      -0.2527488  0.0161286   -15.671  < 2e-16 ***
DESTIN_SZSKSZ05       0.6046051  0.0122766    49.249  < 2e-16 ***
DESTIN_SZSLSZ01      -0.3927387  0.0099790   -39.356  < 2e-16 ***
DESTIN_SZSLSZ04      -0.5942110  0.0086225   -68.914  < 2e-16 ***
DESTIN_SZSRSZ01      -2.6855766  0.0138707  -193.615  < 2e-16 ***
DESTIN_SZTHSZ01      -3.2750084  0.0402668   -81.333  < 2e-16 ***
DESTIN_SZTHSZ03      -1.7964408  0.0261810   -68.616  < 2e-16 ***
DESTIN_SZTHSZ04      -2.6323994  0.0241831  -108.853  < 2e-16 ***
DESTIN_SZTHSZ06      -1.9444390  0.0166052  -117.098  < 2e-16 ***
DESTIN_SZTMSZ01       0.3856054  0.0063086    61.123  < 2e-16 ***
DESTIN_SZTMSZ02       1.8586526  0.0039229   473.790  < 2e-16 ***
DESTIN_SZTMSZ03       1.2601385  0.0044018   286.278  < 2e-16 ***
DESTIN_SZTMSZ04       1.5884327  0.0043362   366.316  < 2e-16 ***
DESTIN_SZTMSZ05       1.0377553  0.0063271   164.018  < 2e-16 ***
DESTIN_SZTNSZ01      -0.9954275  0.0080345  -123.895  < 2e-16 ***
DESTIN_SZTNSZ02      -2.1032696  0.0109228  -192.557  < 2e-16 ***
DESTIN_SZTNSZ03      -2.0044892  0.0129215  -155.128  < 2e-16 ***
DESTIN_SZTNSZ04      -0.9750326  0.0081677  -119.377  < 2e-16 ***
DESTIN_SZTPSZ01      -0.7788383  0.0068769  -113.254  < 2e-16 ***
DESTIN_SZTPSZ02       0.2866080  0.0042843    66.898  < 2e-16 ***
DESTIN_SZTPSZ03      -0.8749841  0.0065470  -133.646  < 2e-16 ***
DESTIN_SZTPSZ04      -1.6852792  0.0081488  -206.812  < 2e-16 ***
DESTIN_SZTPSZ05      -1.3721346  0.0068230  -201.104  < 2e-16 ***
DESTIN_SZTPSZ06      -0.7832133  0.0069164  -113.239  < 2e-16 ***
DESTIN_SZTPSZ07      -2.3109126  0.0130830  -176.635  < 2e-16 ***
DESTIN_SZTPSZ08      -1.6406531  0.0104897  -156.406  < 2e-16 ***
DESTIN_SZTPSZ09      -0.5636273  0.0076848   -73.343  < 2e-16 ***
DESTIN_SZTPSZ10      -1.5640843  0.0099984  -156.433  < 2e-16 ***
DESTIN_SZTPSZ11      -0.3700482  0.0059834   -61.846  < 2e-16 ***
DESTIN_SZTPSZ12      -0.8828228  0.0072302  -122.102  < 2e-16 ***
DESTIN_SZTSSZ01       0.3529526  0.0221887    15.907  < 2e-16 ***
DESTIN_SZTSSZ02       1.0265792  0.0153515    66.871  < 2e-16 ***
DESTIN_SZTSSZ03       1.9647347  0.0092388   212.662  < 2e-16 ***
DESTIN_SZTSSZ04       1.8649836  0.0089976   207.275  < 2e-16 ***
DESTIN_SZTSSZ05       2.8437058  0.0085738   331.673  < 2e-16 ***
DESTIN_SZTSSZ06       3.4238870  0.0161304   212.263  < 2e-16 ***
DESTIN_SZWCSZ01       2.9550693  0.0051690   571.689  < 2e-16 ***
DESTIN_SZWCSZ02      -0.8214103  0.0129213   -63.570  < 2e-16 ***
DESTIN_SZWCSZ03      -1.7393427  0.0347472   -50.057  < 2e-16 ***
DESTIN_SZWDSZ01       1.3424417  0.0039957   335.972  < 2e-16 ***
DESTIN_SZWDSZ02      -0.2103694  0.0068601   -30.666  < 2e-16 ***
DESTIN_SZWDSZ03       0.8268551  0.0051363   160.983  < 2e-16 ***
DESTIN_SZWDSZ04      -0.0643997  0.0079076    -8.144 3.82e-16 ***
DESTIN_SZWDSZ05       0.0451985  0.0075732     5.968 2.40e-09 ***
DESTIN_SZWDSZ06       0.6981330  0.0051936   134.423  < 2e-16 ***
DESTIN_SZWDSZ07      -0.0403233  0.0067749    -5.952 2.65e-09 ***
DESTIN_SZWDSZ08       0.2850631  0.0069225    41.179  < 2e-16 ***
DESTIN_SZWDSZ09       1.3016106  0.0050365   258.433  < 2e-16 ***
DESTIN_SZYSSZ01       0.7598564  0.0044144   172.133  < 2e-16 ***
DESTIN_SZYSSZ02       0.2648061  0.0058239    45.469  < 2e-16 ***
DESTIN_SZYSSZ03      -0.0412163  0.0068337    -6.031 1.63e-09 ***
DESTIN_SZYSSZ04      -0.0561054  0.0060829    -9.223  < 2e-16 ***
DESTIN_SZYSSZ05      -0.9970159  0.0121827   -81.839  < 2e-16 ***
DESTIN_SZYSSZ06      -1.3808376  0.0125738  -109.819  < 2e-16 ***
DESTIN_SZYSSZ07      -0.7128364  0.0165296   -43.125  < 2e-16 ***
DESTIN_SZYSSZ08       0.9409510  0.0045886   205.064  < 2e-16 ***
DESTIN_SZYSSZ09       0.3738436  0.0047971    77.930  < 2e-16 ***
log(ORIGIN_AGE25_64)  0.1928847  0.0001667  1157.214  < 2e-16 ***
log(dist)            -1.7828141  0.0004794 -3718.501  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 36117615  on 14273  degrees of freedom
Residual deviance: 12319763  on 13992  degrees of freedom
AIC: 12404881

Number of Fisher Scoring iterations: 7

We can examine how the constraints hold for destinations this time.

CalcRSquared(decSIM$data$TRIPS, decSIM$fitted.values)
[1] 0.496166

16.13.8 Doubly constrained

In this section, we will fit a doubly constrained SIM by using the code chunk below.

The general formula of Doubly Constrained Spatial Interaction Model

dbcSIM <- glm(formula = TRIPS ~ 
                ORIGIN_SZ + 
                DESTIN_SZ + 
                log(dist),
              family = poisson(link = "log"),
              data = SIM_data,
              na.action = na.exclude)
summary(dbcSIM)

Call:
glm(formula = TRIPS ~ ORIGIN_SZ + DESTIN_SZ + log(dist), family = poisson(link = "log"), 
    data = SIM_data, na.action = na.exclude)

Coefficients:
                  Estimate Std. Error   z value Pr(>|z|)    
(Intercept)     21.9587595  0.0066831  3285.715  < 2e-16 ***
ORIGIN_SZAMSZ02  0.4778050  0.0054127    88.275  < 2e-16 ***
ORIGIN_SZAMSZ03  0.2895973  0.0055517    52.163  < 2e-16 ***
ORIGIN_SZAMSZ04 -0.2628080  0.0060720   -43.282  < 2e-16 ***
ORIGIN_SZAMSZ05 -0.2631404  0.0069008   -38.132  < 2e-16 ***
ORIGIN_SZAMSZ06  0.1722337  0.0062028    27.767  < 2e-16 ***
ORIGIN_SZAMSZ07 -0.9883200  0.0111224   -88.859  < 2e-16 ***
ORIGIN_SZAMSZ08 -0.4052821  0.0104095   -38.934  < 2e-16 ***
ORIGIN_SZAMSZ09  0.0356290  0.0064816     5.497 3.86e-08 ***
ORIGIN_SZAMSZ10  0.4815569  0.0055521    86.735  < 2e-16 ***
ORIGIN_SZAMSZ11 -1.4440079  0.0146079   -98.851  < 2e-16 ***
ORIGIN_SZAMSZ12 -1.7862677  0.0128071  -139.475  < 2e-16 ***
ORIGIN_SZBDSZ01  0.8653749  0.0054381   159.132  < 2e-16 ***
ORIGIN_SZBDSZ02  0.0841000  0.0062834    13.385  < 2e-16 ***
ORIGIN_SZBDSZ03  0.3158343  0.0057510    54.918  < 2e-16 ***
ORIGIN_SZBDSZ04  1.4556701  0.0049986   291.215  < 2e-16 ***
ORIGIN_SZBDSZ05  0.6363125  0.0057193   111.257  < 2e-16 ***
ORIGIN_SZBDSZ06  0.6749341  0.0058650   115.078  < 2e-16 ***
ORIGIN_SZBDSZ07 -1.2176407  0.0113698  -107.095  < 2e-16 ***
ORIGIN_SZBDSZ08 -0.9803580  0.0105604   -92.833  < 2e-16 ***
ORIGIN_SZBKSZ01 -0.2919642  0.0080763   -36.151  < 2e-16 ***
ORIGIN_SZBKSZ02  0.4609570  0.0067997    67.791  < 2e-16 ***
ORIGIN_SZBKSZ03  0.6273448  0.0065989    95.068  < 2e-16 ***
ORIGIN_SZBKSZ04 -0.2499063  0.0076555   -32.644  < 2e-16 ***
ORIGIN_SZBKSZ05 -0.2628428  0.0078905   -33.311  < 2e-16 ***
ORIGIN_SZBKSZ06 -0.2174034  0.0075134   -28.936  < 2e-16 ***
ORIGIN_SZBKSZ07  0.7094093  0.0058574   121.114  < 2e-16 ***
ORIGIN_SZBKSZ08 -0.1614362  0.0067626   -23.872  < 2e-16 ***
ORIGIN_SZBKSZ09 -0.2739085  0.0072969   -37.537  < 2e-16 ***
ORIGIN_SZBLSZ01 -2.4281074  0.0181172  -134.022  < 2e-16 ***
ORIGIN_SZBLSZ02 -2.7305447  0.0219341  -124.489  < 2e-16 ***
ORIGIN_SZBLSZ03 -3.3071431  0.0540398   -61.198  < 2e-16 ***
ORIGIN_SZBLSZ04 -2.4550671  0.0263946   -93.014  < 2e-16 ***
ORIGIN_SZBMSZ01  0.1198976  0.0065964    18.176  < 2e-16 ***
ORIGIN_SZBMSZ02 -1.3908667  0.0083230  -167.112  < 2e-16 ***
ORIGIN_SZBMSZ03 -0.6999122  0.0069754  -100.339  < 2e-16 ***
ORIGIN_SZBMSZ04 -0.2691159  0.0066184   -40.662  < 2e-16 ***
ORIGIN_SZBMSZ05 -2.6163780  0.0190989  -136.991  < 2e-16 ***
ORIGIN_SZBMSZ06 -2.9729956  0.0197182  -150.774  < 2e-16 ***
ORIGIN_SZBMSZ07 -0.7309916  0.0072407  -100.956  < 2e-16 ***
ORIGIN_SZBMSZ08 -1.0019514  0.0073169  -136.936  < 2e-16 ***
ORIGIN_SZBMSZ09 -1.3667460  0.0105325  -129.764  < 2e-16 ***
ORIGIN_SZBMSZ10 -1.6907268  0.0106687  -158.476  < 2e-16 ***
ORIGIN_SZBMSZ11 -1.2288802  0.0082919  -148.202  < 2e-16 ***
ORIGIN_SZBMSZ12 -1.6517767  0.0115101  -143.507  < 2e-16 ***
ORIGIN_SZBMSZ13 -0.7251351  0.0075289   -96.314  < 2e-16 ***
ORIGIN_SZBMSZ14 -1.1534912  0.0082629  -139.599  < 2e-16 ***
ORIGIN_SZBMSZ15 -0.5476774  0.0075710   -72.339  < 2e-16 ***
ORIGIN_SZBMSZ16 -1.5195034  0.0111459  -136.329  < 2e-16 ***
ORIGIN_SZBMSZ17 -1.6026767  0.0184419   -86.904  < 2e-16 ***
ORIGIN_SZBPSZ01  0.5571291  0.0071866    77.523  < 2e-16 ***
ORIGIN_SZBPSZ02  0.0523197  0.0082259     6.360 2.01e-10 ***
ORIGIN_SZBPSZ03  0.2942047  0.0080482    36.555  < 2e-16 ***
ORIGIN_SZBPSZ04  0.6246296  0.0065878    94.816  < 2e-16 ***
ORIGIN_SZBPSZ05  0.8663708  0.0060852   142.372  < 2e-16 ***
ORIGIN_SZBPSZ06 -0.9896182  0.0109551   -90.334  < 2e-16 ***
ORIGIN_SZBPSZ07 -0.5219250  0.0101830   -51.255  < 2e-16 ***
ORIGIN_SZBSSZ01  0.3299588  0.0066440    49.663  < 2e-16 ***
ORIGIN_SZBSSZ02  0.2851357  0.0057077    49.956  < 2e-16 ***
ORIGIN_SZBSSZ03 -0.2084740  0.0063364   -32.901  < 2e-16 ***
ORIGIN_SZBTSZ01  0.1425664  0.0071103    20.051  < 2e-16 ***
ORIGIN_SZBTSZ02 -0.5591999  0.0093616   -59.733  < 2e-16 ***
ORIGIN_SZBTSZ03 -0.3648190  0.0081677   -44.666  < 2e-16 ***
ORIGIN_SZBTSZ04 -1.4555078  0.0120138  -121.152  < 2e-16 ***
ORIGIN_SZBTSZ05 -0.8635510  0.0133848   -64.517  < 2e-16 ***
ORIGIN_SZBTSZ06 -1.1383111  0.0106421  -106.963  < 2e-16 ***
ORIGIN_SZBTSZ07 -2.3477669  0.0160858  -145.953  < 2e-16 ***
ORIGIN_SZBTSZ08 -1.2918779  0.0124862  -103.464  < 2e-16 ***
ORIGIN_SZCBSZ01 -3.3713588  0.0578683   -58.259  < 2e-16 ***
ORIGIN_SZCCSZ01 -0.6029242  0.0153385   -39.308  < 2e-16 ***
ORIGIN_SZCHSZ01 -0.7641380  0.0135100   -56.561  < 2e-16 ***
ORIGIN_SZCHSZ02 -0.8400736  0.0101951   -82.400  < 2e-16 ***
ORIGIN_SZCHSZ03  1.2753127  0.0072576   175.720  < 2e-16 ***
ORIGIN_SZCKSZ01  0.2470943  0.0067135    36.806  < 2e-16 ***
ORIGIN_SZCKSZ02  0.5793581  0.0070498    82.181  < 2e-16 ***
ORIGIN_SZCKSZ03  1.0795767  0.0060642   178.025  < 2e-16 ***
ORIGIN_SZCKSZ04  1.4947920  0.0063122   236.808  < 2e-16 ***
ORIGIN_SZCKSZ05  0.7457580  0.0074071   100.681  < 2e-16 ***
ORIGIN_SZCKSZ06  0.5760952  0.0094861    60.730  < 2e-16 ***
ORIGIN_SZCLSZ01 -0.9061335  0.0098617   -91.884  < 2e-16 ***
ORIGIN_SZCLSZ02 -1.7609479  0.0156124  -112.791  < 2e-16 ***
ORIGIN_SZCLSZ03 -1.0081325  0.0095171  -105.929  < 2e-16 ***
ORIGIN_SZCLSZ04  0.6181200  0.0057953   106.659  < 2e-16 ***
ORIGIN_SZCLSZ05 -2.0462335  0.0168934  -121.127  < 2e-16 ***
ORIGIN_SZCLSZ06  0.7902389  0.0055680   141.924  < 2e-16 ***
ORIGIN_SZCLSZ07 -0.5472929  0.0071001   -77.082  < 2e-16 ***
ORIGIN_SZCLSZ08 -0.2197650  0.0077460   -28.372  < 2e-16 ***
ORIGIN_SZCLSZ09 -1.8175782  0.0195989   -92.739  < 2e-16 ***
ORIGIN_SZDTSZ02 -3.7618796  0.0872098   -43.136  < 2e-16 ***
ORIGIN_SZDTSZ03 -3.4514766  0.0840812   -41.049  < 2e-16 ***
ORIGIN_SZDTSZ13 -3.0627578  0.0352485   -86.891  < 2e-16 ***
ORIGIN_SZGLSZ01 -1.8055929  0.0111938  -161.303  < 2e-16 ***
ORIGIN_SZGLSZ02 -0.1588829  0.0061413   -25.871  < 2e-16 ***
ORIGIN_SZGLSZ03 -0.2508524  0.0064276   -39.027  < 2e-16 ***
ORIGIN_SZGLSZ04  0.8819358  0.0051993   169.627  < 2e-16 ***
ORIGIN_SZGLSZ05  0.6062778  0.0053735   112.828  < 2e-16 ***
ORIGIN_SZHGSZ01  0.3841503  0.0056776    67.660  < 2e-16 ***
ORIGIN_SZHGSZ02  0.3962330  0.0057579    68.815  < 2e-16 ***
ORIGIN_SZHGSZ03  0.2159531  0.0061671    35.017  < 2e-16 ***
ORIGIN_SZHGSZ04  0.7831941  0.0052216   149.992  < 2e-16 ***
ORIGIN_SZHGSZ05  1.1741558  0.0051799   226.677  < 2e-16 ***
ORIGIN_SZHGSZ06 -0.1891403  0.0065556   -28.852  < 2e-16 ***
ORIGIN_SZHGSZ07  0.3105421  0.0057186    54.304  < 2e-16 ***
ORIGIN_SZHGSZ08 -0.0766364  0.0063474   -12.074  < 2e-16 ***
ORIGIN_SZHGSZ09 -1.2211107  0.0101434  -120.384  < 2e-16 ***
ORIGIN_SZHGSZ10 -3.4844709  0.0504793   -69.028  < 2e-16 ***
ORIGIN_SZJESZ01  0.4916496  0.0063444    77.493  < 2e-16 ***
ORIGIN_SZJESZ02  0.1343893  0.0063762    21.077  < 2e-16 ***
ORIGIN_SZJESZ03 -0.2761723  0.0068085   -40.563  < 2e-16 ***
ORIGIN_SZJESZ04 -1.5932744  0.0121402  -131.240  < 2e-16 ***
ORIGIN_SZJESZ05 -2.3041311  0.0160245  -143.788  < 2e-16 ***
ORIGIN_SZJESZ06  0.2811076  0.0062495    44.981  < 2e-16 ***
ORIGIN_SZJESZ07 -1.9413956  0.0136276  -142.461  < 2e-16 ***
ORIGIN_SZJESZ08 -1.3315645  0.0143168   -93.007  < 2e-16 ***
ORIGIN_SZJESZ09  0.4418314  0.0069208    63.841  < 2e-16 ***
ORIGIN_SZJESZ10 -1.5551555  0.0236523   -65.751  < 2e-16 ***
ORIGIN_SZJESZ11 -1.8888230  0.0224630   -84.086  < 2e-16 ***
ORIGIN_SZJWSZ01  0.2564586  0.0084699    30.279  < 2e-16 ***
ORIGIN_SZJWSZ02  0.6899398  0.0061751   111.729  < 2e-16 ***
ORIGIN_SZJWSZ03  1.4761229  0.0057392   257.198  < 2e-16 ***
ORIGIN_SZJWSZ04  0.5701272  0.0065749    86.713  < 2e-16 ***
ORIGIN_SZJWSZ05 -2.1253657  0.0150769  -140.968  < 2e-16 ***
ORIGIN_SZJWSZ06 -1.5307265  0.0131906  -116.047  < 2e-16 ***
ORIGIN_SZJWSZ07 -2.8801618  0.0360772   -79.833  < 2e-16 ***
ORIGIN_SZJWSZ08  1.4428820  0.0059638   241.938  < 2e-16 ***
ORIGIN_SZJWSZ09  1.8968475  0.0055649   340.860  < 2e-16 ***
ORIGIN_SZKLSZ01  0.1116580  0.0059844    18.658  < 2e-16 ***
ORIGIN_SZKLSZ02 -0.9618787  0.0077344  -124.364  < 2e-16 ***
ORIGIN_SZKLSZ03 -0.7070626  0.0070275  -100.613  < 2e-16 ***
ORIGIN_SZKLSZ04 -2.2742765  0.0139991  -162.459  < 2e-16 ***
ORIGIN_SZKLSZ05 -1.1907262  0.0123719   -96.244  < 2e-16 ***
ORIGIN_SZKLSZ06 -5.9774897  0.1857994   -32.172  < 2e-16 ***
ORIGIN_SZKLSZ07 -1.4258369  0.0103083  -138.320  < 2e-16 ***
ORIGIN_SZKLSZ08 -1.7625888  0.0116107  -151.808  < 2e-16 ***
ORIGIN_SZLKSZ01 -2.0541388  0.0448216   -45.829  < 2e-16 ***
ORIGIN_SZMDSZ01 -0.8571117  0.0321054   -26.697  < 2e-16 ***
ORIGIN_SZMDSZ02 -0.6034597  0.0120724   -49.987  < 2e-16 ***
ORIGIN_SZMDSZ03 -2.1681163  0.0201078  -107.825  < 2e-16 ***
ORIGIN_SZMPSZ01 -0.9331562  0.0096218   -96.984  < 2e-16 ***
ORIGIN_SZMPSZ02 -1.0268229  0.0081379  -126.178  < 2e-16 ***
ORIGIN_SZMPSZ03  0.0054001  0.0066875     0.807 0.419385    
ORIGIN_SZMUSZ02 -3.6269863  0.1105492   -32.809  < 2e-16 ***
ORIGIN_SZNTSZ01 -3.0593717  0.0399843   -76.514  < 2e-16 ***
ORIGIN_SZNTSZ02 -3.3331415  0.0251754  -132.397  < 2e-16 ***
ORIGIN_SZNTSZ03 -0.8351522  0.0090372   -92.413  < 2e-16 ***
ORIGIN_SZNTSZ05 -4.2082472  0.0583343   -72.140  < 2e-16 ***
ORIGIN_SZNTSZ06 -3.8549296  0.0593793   -64.920  < 2e-16 ***
ORIGIN_SZNVSZ01  0.2789069  0.0056024    49.784  < 2e-16 ***
ORIGIN_SZNVSZ02 -0.6036857  0.0077126   -78.273  < 2e-16 ***
ORIGIN_SZNVSZ03 -1.0072683  0.0092678  -108.685  < 2e-16 ***
ORIGIN_SZNVSZ04 -0.8723996  0.0101399   -86.037  < 2e-16 ***
ORIGIN_SZNVSZ05 -2.1552928  0.0183064  -117.734  < 2e-16 ***
ORIGIN_SZPGSZ01  0.0520607  0.0157846     3.298 0.000973 ***
ORIGIN_SZPGSZ02 -0.3481687  0.0089328   -38.976  < 2e-16 ***
ORIGIN_SZPGSZ03  0.9095292  0.0058835   154.590  < 2e-16 ***
ORIGIN_SZPGSZ04  1.3653717  0.0054727   249.489  < 2e-16 ***
ORIGIN_SZPGSZ05  0.3762720  0.0073841    50.957  < 2e-16 ***
ORIGIN_SZPLSZ01 -0.9142754  0.0136552   -66.954  < 2e-16 ***
ORIGIN_SZPLSZ02 -1.0987582  0.0175891   -62.468  < 2e-16 ***
ORIGIN_SZPLSZ03 -2.3427113  0.0474176   -49.406  < 2e-16 ***
ORIGIN_SZPLSZ04 -2.9140779  0.0374458   -77.821  < 2e-16 ***
ORIGIN_SZPLSZ05 -2.2381965  0.0261572   -85.567  < 2e-16 ***
ORIGIN_SZPNSZ01  0.9659006  0.0075177   128.484  < 2e-16 ***
ORIGIN_SZPNSZ02 -0.0158348  0.0143869    -1.101 0.271053    
ORIGIN_SZPNSZ03 -2.1837321  0.0224396   -97.316  < 2e-16 ***
ORIGIN_SZPNSZ04 -3.2481509  0.0370762   -87.608  < 2e-16 ***
ORIGIN_SZPNSZ05 -2.0450679  0.0328165   -62.318  < 2e-16 ***
ORIGIN_SZPRSZ01 -0.6701245  0.0141567   -47.336  < 2e-16 ***
ORIGIN_SZPRSZ02  0.7931907  0.0058079   136.570  < 2e-16 ***
ORIGIN_SZPRSZ03  0.4249094  0.0058610    72.498  < 2e-16 ***
ORIGIN_SZPRSZ04 -0.8529967  0.0090997   -93.739  < 2e-16 ***
ORIGIN_SZPRSZ05  0.7865479  0.0055282   142.278  < 2e-16 ***
ORIGIN_SZPRSZ06 -1.3303664  0.0134512   -98.903  < 2e-16 ***
ORIGIN_SZPRSZ07 -3.0458370  0.0181514  -167.802  < 2e-16 ***
ORIGIN_SZPRSZ08 -0.5342399  0.0075966   -70.327  < 2e-16 ***
ORIGIN_SZQTSZ01 -0.2548930  0.0086485   -29.473  < 2e-16 ***
ORIGIN_SZQTSZ02 -0.8662439  0.0076549  -113.162  < 2e-16 ***
ORIGIN_SZQTSZ03 -0.0890168  0.0072455   -12.286  < 2e-16 ***
ORIGIN_SZQTSZ04 -1.4634370  0.0089384  -163.724  < 2e-16 ***
ORIGIN_SZQTSZ05 -0.6535669  0.0077612   -84.210  < 2e-16 ***
ORIGIN_SZQTSZ06 -0.8275765  0.0081835  -101.128  < 2e-16 ***
ORIGIN_SZQTSZ07 -1.5369800  0.0112808  -136.248  < 2e-16 ***
ORIGIN_SZQTSZ08 -0.4437979  0.0075302   -58.936  < 2e-16 ***
ORIGIN_SZQTSZ09 -0.8184934  0.0083589   -97.918  < 2e-16 ***
ORIGIN_SZQTSZ10 -0.6906597  0.0080980   -85.288  < 2e-16 ***
ORIGIN_SZQTSZ11 -2.3251162  0.0154191  -150.795  < 2e-16 ***
ORIGIN_SZQTSZ12 -3.0442790  0.0208985  -145.670  < 2e-16 ***
ORIGIN_SZQTSZ13 -0.7241013  0.0093441   -77.493  < 2e-16 ***
ORIGIN_SZQTSZ14 -1.8225351  0.0138207  -131.870  < 2e-16 ***
ORIGIN_SZQTSZ15 -0.8720806  0.0138589   -62.926  < 2e-16 ***
ORIGIN_SZRCSZ01 -1.8063415  0.0144295  -125.184  < 2e-16 ***
ORIGIN_SZRCSZ06 -0.5370905  0.0101573   -52.877  < 2e-16 ***
ORIGIN_SZRVSZ01 -2.7426167  0.0341386   -80.338  < 2e-16 ***
ORIGIN_SZRVSZ02 -3.0827269  0.0302299  -101.976  < 2e-16 ***
ORIGIN_SZRVSZ03 -2.9133853  0.0262543  -110.968  < 2e-16 ***
ORIGIN_SZRVSZ04 -3.4220022  0.0582209   -58.776  < 2e-16 ***
ORIGIN_SZRVSZ05 -2.6206257  0.0197470  -132.710  < 2e-16 ***
ORIGIN_SZSBSZ01  0.1010337  0.0085117    11.870  < 2e-16 ***
ORIGIN_SZSBSZ02 -0.8810456  0.0098244   -89.680  < 2e-16 ***
ORIGIN_SZSBSZ03  0.8303668  0.0063009   131.785  < 2e-16 ***
ORIGIN_SZSBSZ04  0.3489128  0.0071456    48.829  < 2e-16 ***
ORIGIN_SZSBSZ05 -0.3182914  0.0085560   -37.201  < 2e-16 ***
ORIGIN_SZSBSZ06 -0.9074308  0.0200035   -45.364  < 2e-16 ***
ORIGIN_SZSBSZ07 -0.2217124  0.0167188   -13.261  < 2e-16 ***
ORIGIN_SZSBSZ08 -1.3007367  0.0178771   -72.760  < 2e-16 ***
ORIGIN_SZSBSZ09 -0.9813703  0.0107885   -90.965  < 2e-16 ***
ORIGIN_SZSESZ02  1.1283424  0.0054209   208.146  < 2e-16 ***
ORIGIN_SZSESZ03  1.2389996  0.0051926   238.610  < 2e-16 ***
ORIGIN_SZSESZ04  0.7535119  0.0060371   124.814  < 2e-16 ***
ORIGIN_SZSESZ05 -0.2347978  0.0071482   -32.847  < 2e-16 ***
ORIGIN_SZSESZ06  0.9520620  0.0057572   165.368  < 2e-16 ***
ORIGIN_SZSESZ07 -2.4296685  0.0231677  -104.873  < 2e-16 ***
ORIGIN_SZSGSZ01 -0.6995899  0.0099969   -69.980  < 2e-16 ***
ORIGIN_SZSGSZ02 -1.2602157  0.0111471  -113.053  < 2e-16 ***
ORIGIN_SZSGSZ03  0.0725860  0.0061970    11.713  < 2e-16 ***
ORIGIN_SZSGSZ04  0.2738315  0.0057524    47.603  < 2e-16 ***
ORIGIN_SZSGSZ05 -2.0207710  0.0119838  -168.625  < 2e-16 ***
ORIGIN_SZSGSZ06  0.4885608  0.0054646    89.404  < 2e-16 ***
ORIGIN_SZSGSZ07 -0.8892155  0.0075074  -118.445  < 2e-16 ***
ORIGIN_SZSKSZ01 -0.3682754  0.0108025   -34.092  < 2e-16 ***
ORIGIN_SZSKSZ02  1.1826086  0.0071388   165.659  < 2e-16 ***
ORIGIN_SZSKSZ03 -0.3230177  0.0101683   -31.767  < 2e-16 ***
ORIGIN_SZSKSZ04 -1.8504236  0.0362400   -51.060  < 2e-16 ***
ORIGIN_SZSKSZ05 -0.2759035  0.0185157   -14.901  < 2e-16 ***
ORIGIN_SZSLSZ01 -2.2757902  0.0348766   -65.253  < 2e-16 ***
ORIGIN_SZSLSZ04 -0.0899820  0.0090356    -9.959  < 2e-16 ***
ORIGIN_SZSRSZ01 -2.1460151  0.0187871  -114.228  < 2e-16 ***
ORIGIN_SZTHSZ01 -2.6851549  0.0571841   -46.956  < 2e-16 ***
ORIGIN_SZTHSZ03 -1.0121495  0.0275551   -36.732  < 2e-16 ***
ORIGIN_SZTHSZ04 -2.6129645  0.0345167   -75.701  < 2e-16 ***
ORIGIN_SZTHSZ06 -1.7229100  0.0208134   -82.779  < 2e-16 ***
ORIGIN_SZTMSZ01 -0.2254986  0.0070312   -32.071  < 2e-16 ***
ORIGIN_SZTMSZ02  1.7271575  0.0049219   350.914  < 2e-16 ***
ORIGIN_SZTMSZ03  0.9891319  0.0052266   189.250  < 2e-16 ***
ORIGIN_SZTMSZ04  0.2018090  0.0062114    32.490  < 2e-16 ***
ORIGIN_SZTMSZ05 -1.1882870  0.0125842   -94.427  < 2e-16 ***
ORIGIN_SZTNSZ01 -1.6122620  0.0141911  -113.611  < 2e-16 ***
ORIGIN_SZTNSZ02 -1.5630967  0.0112227  -139.280  < 2e-16 ***
ORIGIN_SZTNSZ03 -2.0739538  0.0149298  -138.914  < 2e-16 ***
ORIGIN_SZTNSZ04 -0.2816960  0.0085295   -33.026  < 2e-16 ***
ORIGIN_SZTPSZ01 -0.7822239  0.0077901  -100.412  < 2e-16 ***
ORIGIN_SZTPSZ02  0.5735478  0.0053042   108.131  < 2e-16 ***
ORIGIN_SZTPSZ03 -0.8748650  0.0074202  -117.903  < 2e-16 ***
ORIGIN_SZTPSZ04 -0.8537831  0.0069792  -122.332  < 2e-16 ***
ORIGIN_SZTPSZ05 -0.5581114  0.0077012   -72.471  < 2e-16 ***
ORIGIN_SZTPSZ06  0.0262001  0.0075241     3.482 0.000497 ***
ORIGIN_SZTPSZ07 -0.5969952  0.0074272   -80.380  < 2e-16 ***
ORIGIN_SZTPSZ08 -1.0537959  0.0111297   -94.683  < 2e-16 ***
ORIGIN_SZTPSZ09 -0.9588508  0.0081314  -117.920  < 2e-16 ***
ORIGIN_SZTPSZ10 -1.1177249  0.0089403  -125.021  < 2e-16 ***
ORIGIN_SZTPSZ11 -0.2799677  0.0067135   -41.702  < 2e-16 ***
ORIGIN_SZTPSZ12 -0.8898871  0.0080215  -110.938  < 2e-16 ***
ORIGIN_SZTSSZ01 -2.6146463  0.0521606   -50.127  < 2e-16 ***
ORIGIN_SZTSSZ02  0.1682588  0.0119965    14.026  < 2e-16 ***
ORIGIN_SZTSSZ03  0.2587653  0.0123809    20.900  < 2e-16 ***
ORIGIN_SZTSSZ04 -0.5473825  0.0135215   -40.482  < 2e-16 ***
ORIGIN_SZTSSZ05 -0.9967379  0.0206068   -48.369  < 2e-16 ***
ORIGIN_SZTSSZ06  0.4933147  0.0229597    21.486  < 2e-16 ***
ORIGIN_SZWCSZ01  1.2524706  0.0111133   112.700  < 2e-16 ***
ORIGIN_SZWCSZ02 -2.8544820  0.0347805   -82.071  < 2e-16 ***
ORIGIN_SZWCSZ03 -5.1277334  0.1475585   -34.751  < 2e-16 ***
ORIGIN_SZWDSZ01  1.4725308  0.0056496   260.645  < 2e-16 ***
ORIGIN_SZWDSZ02  0.1571680  0.0064909    24.214  < 2e-16 ***
ORIGIN_SZWDSZ03  1.2584097  0.0061471   204.717  < 2e-16 ***
ORIGIN_SZWDSZ04  0.8578765  0.0069277   123.833  < 2e-16 ***
ORIGIN_SZWDSZ05  0.1702728  0.0069687    24.434  < 2e-16 ***
ORIGIN_SZWDSZ06  0.1736910  0.0069507    24.989  < 2e-16 ***
ORIGIN_SZWDSZ07 -1.5610176  0.0100803  -154.859  < 2e-16 ***
ORIGIN_SZWDSZ08 -0.9490906  0.0102047   -93.005  < 2e-16 ***
ORIGIN_SZWDSZ09  1.2107011  0.0062294   194.354  < 2e-16 ***
ORIGIN_SZYSSZ01 -0.3324158  0.0074537   -44.598  < 2e-16 ***
ORIGIN_SZYSSZ02  0.8177113  0.0066108   123.693  < 2e-16 ***
ORIGIN_SZYSSZ03  1.6751777  0.0058470   286.503  < 2e-16 ***
ORIGIN_SZYSSZ04  0.8130044  0.0059025   137.738  < 2e-16 ***
ORIGIN_SZYSSZ05  0.3678420  0.0072431    50.785  < 2e-16 ***
ORIGIN_SZYSSZ06 -0.6024384  0.0126722   -47.540  < 2e-16 ***
ORIGIN_SZYSSZ07 -0.7631918  0.0158478   -48.157  < 2e-16 ***
ORIGIN_SZYSSZ08  0.2141930  0.0076154    28.126  < 2e-16 ***
ORIGIN_SZYSSZ09  1.0809368  0.0057973   186.457  < 2e-16 ***
DESTIN_SZAMSZ02  0.0761304  0.0051207    14.867  < 2e-16 ***
DESTIN_SZAMSZ03  0.0143394  0.0050755     2.825 0.004724 ** 
DESTIN_SZAMSZ04 -1.2516780  0.0074947  -167.008  < 2e-16 ***
DESTIN_SZAMSZ05 -1.2312375  0.0076598  -160.741  < 2e-16 ***
DESTIN_SZAMSZ06 -1.0333412  0.0075283  -137.261  < 2e-16 ***
DESTIN_SZAMSZ07 -1.5338249  0.0110036  -139.392  < 2e-16 ***
DESTIN_SZAMSZ08 -0.3751665  0.0075358   -49.784  < 2e-16 ***
DESTIN_SZAMSZ09 -1.1633493  0.0077556  -150.001  < 2e-16 ***
DESTIN_SZAMSZ10  0.1017717  0.0053151    19.148  < 2e-16 ***
DESTIN_SZAMSZ11 -0.8840362  0.0097007   -91.131  < 2e-16 ***
DESTIN_SZAMSZ12  0.1628123  0.0055220    29.484  < 2e-16 ***
DESTIN_SZBDSZ01  1.0040794  0.0047922   209.523  < 2e-16 ***
DESTIN_SZBDSZ02 -0.2478149  0.0063085   -39.283  < 2e-16 ***
DESTIN_SZBDSZ03  0.1016088  0.0057420    17.696  < 2e-16 ***
DESTIN_SZBDSZ04  1.1082928  0.0047747   232.116  < 2e-16 ***
DESTIN_SZBDSZ05  0.8737933  0.0050593   172.712  < 2e-16 ***
DESTIN_SZBDSZ06  0.2897032  0.0058244    49.740  < 2e-16 ***
DESTIN_SZBDSZ07 -0.9026193  0.0113656   -79.416  < 2e-16 ***
DESTIN_SZBDSZ08 -1.7063577  0.0131234  -130.024  < 2e-16 ***
DESTIN_SZBKSZ01 -1.3892839  0.0083307  -166.767  < 2e-16 ***
DESTIN_SZBKSZ02 -0.6661120  0.0073464   -90.672  < 2e-16 ***
DESTIN_SZBKSZ03 -0.9536826  0.0073196  -130.292  < 2e-16 ***
DESTIN_SZBKSZ04 -0.6655610  0.0065868  -101.044  < 2e-16 ***
DESTIN_SZBKSZ05 -0.9053119  0.0079264  -114.215  < 2e-16 ***
DESTIN_SZBKSZ06 -1.2622159  0.0075079  -168.119  < 2e-16 ***
DESTIN_SZBKSZ07 -0.0423370  0.0056686    -7.469 8.10e-14 ***
DESTIN_SZBKSZ08 -1.3811240  0.0084985  -162.515  < 2e-16 ***
DESTIN_SZBKSZ09 -0.0797012  0.0061428   -12.975  < 2e-16 ***
DESTIN_SZBLSZ01 -0.8859670  0.0088108  -100.555  < 2e-16 ***
DESTIN_SZBLSZ02  0.1362723  0.0082167    16.585  < 2e-16 ***
DESTIN_SZBLSZ03  1.2037396  0.0093508   128.732  < 2e-16 ***
DESTIN_SZBLSZ04 -0.9316219  0.0178080   -52.315  < 2e-16 ***
DESTIN_SZBMSZ01  0.7188470  0.0061160   117.536  < 2e-16 ***
DESTIN_SZBMSZ02 -0.0597895  0.0061206    -9.769  < 2e-16 ***
DESTIN_SZBMSZ03 -0.2427075  0.0069937   -34.704  < 2e-16 ***
DESTIN_SZBMSZ04 -0.0622494  0.0065569    -9.494  < 2e-16 ***
DESTIN_SZBMSZ05 -0.2857019  0.0086450   -33.048  < 2e-16 ***
DESTIN_SZBMSZ06 -1.3486558  0.0158904   -84.872  < 2e-16 ***
DESTIN_SZBMSZ07  0.4549687  0.0058315    78.020  < 2e-16 ***
DESTIN_SZBMSZ08 -0.8730268  0.0077814  -112.195  < 2e-16 ***
DESTIN_SZBMSZ09 -2.0319890  0.0163038  -124.633  < 2e-16 ***
DESTIN_SZBMSZ10 -1.4319101  0.0102616  -139.541  < 2e-16 ***
DESTIN_SZBMSZ11 -1.2429176  0.0092250  -134.733  < 2e-16 ***
DESTIN_SZBMSZ12 -0.8526549  0.0096009   -88.810  < 2e-16 ***
DESTIN_SZBMSZ13  0.1399907  0.0066885    20.930  < 2e-16 ***
DESTIN_SZBMSZ14 -1.0103155  0.0091377  -110.566  < 2e-16 ***
DESTIN_SZBMSZ15 -0.6819769  0.0086179   -79.135  < 2e-16 ***
DESTIN_SZBMSZ16 -1.4468308  0.0134051  -107.931  < 2e-16 ***
DESTIN_SZBMSZ17 -1.5312175  0.0186843   -81.952  < 2e-16 ***
DESTIN_SZBPSZ01 -1.1726725  0.0073257  -160.077  < 2e-16 ***
DESTIN_SZBPSZ02 -2.1072012  0.0103320  -203.949  < 2e-16 ***
DESTIN_SZBPSZ03 -1.6944911  0.0098520  -171.995  < 2e-16 ***
DESTIN_SZBPSZ04 -0.7664610  0.0074458  -102.939  < 2e-16 ***
DESTIN_SZBPSZ05  0.1358370  0.0056258    24.145  < 2e-16 ***
DESTIN_SZBPSZ06 -1.2425471  0.0096942  -128.175  < 2e-16 ***
DESTIN_SZBPSZ07 -0.1666192  0.0094969   -17.545  < 2e-16 ***
DESTIN_SZBSSZ01  0.3857894  0.0057261    67.374  < 2e-16 ***
DESTIN_SZBSSZ02 -0.5293265  0.0064886   -81.578  < 2e-16 ***
DESTIN_SZBSSZ03  0.3909966  0.0048540    80.551  < 2e-16 ***
DESTIN_SZBTSZ01  0.7114965  0.0054528   130.482  < 2e-16 ***
DESTIN_SZBTSZ02 -0.0487084  0.0082474    -5.906 3.51e-09 ***
DESTIN_SZBTSZ03  0.5539032  0.0064423    85.979  < 2e-16 ***
DESTIN_SZBTSZ04 -0.7120734  0.0128676   -55.339  < 2e-16 ***
DESTIN_SZBTSZ05  0.2176097  0.0086791    25.073  < 2e-16 ***
DESTIN_SZBTSZ06 -0.2167084  0.0084925   -25.518  < 2e-16 ***
DESTIN_SZBTSZ07 -1.4045618  0.0124363  -112.940  < 2e-16 ***
DESTIN_SZBTSZ08 -0.8213918  0.0120793   -68.000  < 2e-16 ***
DESTIN_SZCBSZ01 -5.7340877  0.3333916   -17.199  < 2e-16 ***
DESTIN_SZCCSZ01 -0.0304192  0.0095920    -3.171 0.001518 ** 
DESTIN_SZCHSZ01 -0.2598507  0.0115311   -22.535  < 2e-16 ***
DESTIN_SZCHSZ02  0.3497750  0.0068334    51.186  < 2e-16 ***
DESTIN_SZCHSZ03  2.4550172  0.0050883   482.481  < 2e-16 ***
DESTIN_SZCKSZ01 -0.4691744  0.0063130   -74.319  < 2e-16 ***
DESTIN_SZCKSZ02 -0.9557084  0.0069331  -137.847  < 2e-16 ***
DESTIN_SZCKSZ03  0.0442112  0.0057117     7.740 9.91e-15 ***
DESTIN_SZCKSZ04 -0.8592063  0.0081238  -105.764  < 2e-16 ***
DESTIN_SZCKSZ05 -1.1745333  0.0087305  -134.532  < 2e-16 ***
DESTIN_SZCKSZ06 -0.4982877  0.0085514   -58.269  < 2e-16 ***
DESTIN_SZCLSZ01  0.2665065  0.0059712    44.632  < 2e-16 ***
DESTIN_SZCLSZ02 -1.9758876  0.0150823  -131.007  < 2e-16 ***
DESTIN_SZCLSZ03 -0.9051310  0.0091479   -98.944  < 2e-16 ***
DESTIN_SZCLSZ04 -0.0828732  0.0061559   -13.462  < 2e-16 ***
DESTIN_SZCLSZ05 -1.1414780  0.0100760  -113.287  < 2e-16 ***
DESTIN_SZCLSZ06  0.3229402  0.0056269    57.392  < 2e-16 ***
DESTIN_SZCLSZ07 -0.4833612  0.0069777   -69.272  < 2e-16 ***
DESTIN_SZCLSZ08 -0.3219670  0.0075615   -42.580  < 2e-16 ***
DESTIN_SZCLSZ09  0.0564166  0.0080703     6.991 2.74e-12 ***
DESTIN_SZDTSZ02 -1.6384236  0.0374725   -43.723  < 2e-16 ***
DESTIN_SZDTSZ03 -0.4021571  0.0152716   -26.334  < 2e-16 ***
DESTIN_SZDTSZ13 -1.2799441  0.0177095   -72.274  < 2e-16 ***
DESTIN_SZGLSZ01 -0.0190303  0.0060665    -3.137 0.001707 ** 
DESTIN_SZGLSZ02 -0.0308469  0.0058724    -5.253 1.50e-07 ***
DESTIN_SZGLSZ03  0.6927638  0.0048456   142.969  < 2e-16 ***
DESTIN_SZGLSZ04  0.9325848  0.0049183   189.616  < 2e-16 ***
DESTIN_SZGLSZ05  0.8480056  0.0048801   173.768  < 2e-16 ***
DESTIN_SZHGSZ01  0.0652969  0.0047795    13.662  < 2e-16 ***
DESTIN_SZHGSZ02 -0.9498251  0.0066577  -142.667  < 2e-16 ***
DESTIN_SZHGSZ03 -1.4372499  0.0076387  -188.154  < 2e-16 ***
DESTIN_SZHGSZ04 -0.5236292  0.0055353   -94.599  < 2e-16 ***
DESTIN_SZHGSZ05 -0.5420295  0.0058099   -93.295  < 2e-16 ***
DESTIN_SZHGSZ06 -0.9054730  0.0067581  -133.983  < 2e-16 ***
DESTIN_SZHGSZ07  0.0215109  0.0054019     3.982 6.83e-05 ***
DESTIN_SZHGSZ08 -0.0490979  0.0059206    -8.293  < 2e-16 ***
DESTIN_SZHGSZ09 -0.0711560  0.0062875   -11.317  < 2e-16 ***
DESTIN_SZHGSZ10 -3.5807154  0.0290642  -123.200  < 2e-16 ***
DESTIN_SZJESZ01 -0.4023638  0.0065057   -61.848  < 2e-16 ***
DESTIN_SZJESZ02 -0.7654353  0.0067096  -114.081  < 2e-16 ***
DESTIN_SZJESZ03 -0.8778812  0.0071238  -123.232  < 2e-16 ***
DESTIN_SZJESZ04 -1.1998075  0.0088733  -135.215  < 2e-16 ***
DESTIN_SZJESZ05 -1.5623652  0.0116898  -133.652  < 2e-16 ***
DESTIN_SZJESZ06  0.2311474  0.0055595    41.577  < 2e-16 ***
DESTIN_SZJESZ07 -1.2753348  0.0094838  -134.475  < 2e-16 ***
DESTIN_SZJESZ08 -0.7654533  0.0099306   -77.081  < 2e-16 ***
DESTIN_SZJESZ09  0.1637628  0.0074164    22.081  < 2e-16 ***
DESTIN_SZJESZ10  0.7394958  0.0091249    81.041  < 2e-16 ***
DESTIN_SZJESZ11  0.5157364  0.0086546    59.591  < 2e-16 ***
DESTIN_SZJWSZ01 -1.0165204  0.0083025  -122.435  < 2e-16 ***
DESTIN_SZJWSZ02 -0.8530646  0.0067851  -125.727  < 2e-16 ***
DESTIN_SZJWSZ03  0.5176135  0.0056449    91.695  < 2e-16 ***
DESTIN_SZJWSZ04  0.3427105  0.0058499    58.584  < 2e-16 ***
DESTIN_SZJWSZ05 -1.1695940  0.0080069  -146.073  < 2e-16 ***
DESTIN_SZJWSZ06 -0.7466462  0.0070240  -106.299  < 2e-16 ***
DESTIN_SZJWSZ07 -3.0124535  0.0333481   -90.334  < 2e-16 ***
DESTIN_SZJWSZ08 -0.4253502  0.0066584   -63.881  < 2e-16 ***
DESTIN_SZJWSZ09  0.9428005  0.0053190   177.251  < 2e-16 ***
DESTIN_SZKLSZ01 -0.2965013  0.0066422   -44.639  < 2e-16 ***
DESTIN_SZKLSZ02 -0.4921137  0.0067689   -72.702  < 2e-16 ***
DESTIN_SZKLSZ03 -0.8489213  0.0078294  -108.427  < 2e-16 ***
DESTIN_SZKLSZ04 -1.2656342  0.0099918  -126.667  < 2e-16 ***
DESTIN_SZKLSZ05 -0.3570126  0.0096300   -37.073  < 2e-16 ***
DESTIN_SZKLSZ06 -2.4764906  0.0390868   -63.359  < 2e-16 ***
DESTIN_SZKLSZ07 -0.7316189  0.0080994   -90.330  < 2e-16 ***
DESTIN_SZKLSZ08 -0.1115398  0.0061168   -18.235  < 2e-16 ***
DESTIN_SZLKSZ01 -1.4940710  0.0271518   -55.027  < 2e-16 ***
DESTIN_SZMDSZ01 -1.6101440  0.0231238   -69.631  < 2e-16 ***
DESTIN_SZMDSZ02 -0.9339318  0.0126277   -73.959  < 2e-16 ***
DESTIN_SZMDSZ03 -3.4868547  0.0303657  -114.829  < 2e-16 ***
DESTIN_SZMPSZ01 -0.4518483  0.0089869   -50.279  < 2e-16 ***
DESTIN_SZMPSZ02 -0.5868264  0.0073193   -80.176  < 2e-16 ***
DESTIN_SZMPSZ03  0.4805365  0.0059041    81.391  < 2e-16 ***
DESTIN_SZMUSZ02 -1.3837581  0.0218713   -63.268  < 2e-16 ***
DESTIN_SZNTSZ01 -3.0694691  0.0533346   -57.551  < 2e-16 ***
DESTIN_SZNTSZ02 -1.4992973  0.0130358  -115.014  < 2e-16 ***
DESTIN_SZNTSZ03 -0.5221236  0.0089923   -58.064  < 2e-16 ***
DESTIN_SZNTSZ05 -1.9751162  0.0282369   -69.948  < 2e-16 ***
DESTIN_SZNTSZ06 -3.9959411  0.0511214   -78.166  < 2e-16 ***
DESTIN_SZNVSZ01 -0.1126966  0.0057077   -19.745  < 2e-16 ***
DESTIN_SZNVSZ02 -0.0259250  0.0064427    -4.024 5.72e-05 ***
DESTIN_SZNVSZ03 -0.0123214  0.0067692    -1.820 0.068725 .  
DESTIN_SZNVSZ04 -1.3371298  0.0130261  -102.650  < 2e-16 ***
DESTIN_SZNVSZ05 -0.9686333  0.0101539   -95.395  < 2e-16 ***
DESTIN_SZPGSZ01 -1.1798309  0.0180543   -65.349  < 2e-16 ***
DESTIN_SZPGSZ02 -1.3289737  0.0085335  -155.736  < 2e-16 ***
DESTIN_SZPGSZ03 -0.1661373  0.0055166   -30.116  < 2e-16 ***
DESTIN_SZPGSZ04 -0.3046408  0.0058469   -52.103  < 2e-16 ***
DESTIN_SZPGSZ05 -1.5412612  0.0093261  -165.264  < 2e-16 ***
DESTIN_SZPLSZ01 -0.3439667  0.0083504   -41.192  < 2e-16 ***
DESTIN_SZPLSZ02 -1.7574919  0.0154244  -113.942  < 2e-16 ***
DESTIN_SZPLSZ03 -0.3455776  0.0112089   -30.831  < 2e-16 ***
DESTIN_SZPLSZ04 -2.0749385  0.0141153  -146.999  < 2e-16 ***
DESTIN_SZPLSZ05 -0.4855216  0.0134069   -36.214  < 2e-16 ***
DESTIN_SZPNSZ01  0.0117816  0.0083558     1.410 0.158543    
DESTIN_SZPNSZ02  0.7389858  0.0089823    82.272  < 2e-16 ***
DESTIN_SZPNSZ03 -0.4708719  0.0098588   -47.761  < 2e-16 ***
DESTIN_SZPNSZ04  1.3156771  0.0111200   118.316  < 2e-16 ***
DESTIN_SZPNSZ05  0.9881886  0.0153169    64.516  < 2e-16 ***
DESTIN_SZPRSZ01 -1.0678999  0.0098295  -108.642  < 2e-16 ***
DESTIN_SZPRSZ02  0.0650279  0.0063927    10.172  < 2e-16 ***
DESTIN_SZPRSZ03  0.6348138  0.0050147   126.592  < 2e-16 ***
DESTIN_SZPRSZ04 -0.3640286  0.0097572   -37.309  < 2e-16 ***
DESTIN_SZPRSZ05  0.0380410  0.0062577     6.079 1.21e-09 ***
DESTIN_SZPRSZ06  0.3153712  0.0068742    45.877  < 2e-16 ***
DESTIN_SZPRSZ07 -1.6669973  0.0145573  -114.513  < 2e-16 ***
DESTIN_SZPRSZ08 -0.6170648  0.0078424   -78.683  < 2e-16 ***
DESTIN_SZQTSZ01 -0.5496582  0.0098285   -55.925  < 2e-16 ***
DESTIN_SZQTSZ02 -0.7318114  0.0086807   -84.303  < 2e-16 ***
DESTIN_SZQTSZ03 -0.5893064  0.0084789   -69.503  < 2e-16 ***
DESTIN_SZQTSZ04 -0.7103906  0.0085341   -83.242  < 2e-16 ***
DESTIN_SZQTSZ05 -0.4721472  0.0078164   -60.405  < 2e-16 ***
DESTIN_SZQTSZ06 -0.6591466  0.0080069   -82.322  < 2e-16 ***
DESTIN_SZQTSZ07 -0.9540454  0.0126807   -75.236  < 2e-16 ***
DESTIN_SZQTSZ08  0.4508867  0.0064870    69.507  < 2e-16 ***
DESTIN_SZQTSZ09 -0.4061810  0.0075485   -53.810  < 2e-16 ***
DESTIN_SZQTSZ10  0.1351889  0.0068202    19.822  < 2e-16 ***
DESTIN_SZQTSZ11  0.3181553  0.0067958    46.816  < 2e-16 ***
DESTIN_SZQTSZ12 -0.1055766  0.0095576   -11.046  < 2e-16 ***
DESTIN_SZQTSZ13  0.5199663  0.0071928    72.290  < 2e-16 ***
DESTIN_SZQTSZ14  0.6086332  0.0078537    77.496  < 2e-16 ***
DESTIN_SZQTSZ15  1.3906866  0.0092250   150.753  < 2e-16 ***
DESTIN_SZRCSZ01 -0.0862091  0.0085363   -10.099  < 2e-16 ***
DESTIN_SZRCSZ06 -1.0186282  0.0211113   -48.250  < 2e-16 ***
DESTIN_SZRVSZ01 -1.5294454  0.0179337   -85.283  < 2e-16 ***
DESTIN_SZRVSZ02 -2.3607754  0.0355628   -66.383  < 2e-16 ***
DESTIN_SZRVSZ03 -1.5266254  0.0156276   -97.688  < 2e-16 ***
DESTIN_SZRVSZ04 -1.0986565  0.0168695   -65.127  < 2e-16 ***
DESTIN_SZRVSZ05 -2.4004418  0.0320917   -74.799  < 2e-16 ***
DESTIN_SZSBSZ01 -1.4023966  0.0109496  -128.078  < 2e-16 ***
DESTIN_SZSBSZ02 -1.3899893  0.0090891  -152.929  < 2e-16 ***
DESTIN_SZSBSZ03  0.4509008  0.0059864    75.321  < 2e-16 ***
DESTIN_SZSBSZ04  0.1796309  0.0070142    25.610  < 2e-16 ***
DESTIN_SZSBSZ05 -1.3159699  0.0096485  -136.391  < 2e-16 ***
DESTIN_SZSBSZ06 -1.7705263  0.0253064   -69.964  < 2e-16 ***
DESTIN_SZSBSZ07 -0.7471529  0.0238628   -31.310  < 2e-16 ***
DESTIN_SZSBSZ08  0.7884520  0.0069638   113.221  < 2e-16 ***
DESTIN_SZSBSZ09  0.0131702  0.0066350     1.985 0.047150 *  
DESTIN_SZSESZ02 -0.7247347  0.0060626  -119.541  < 2e-16 ***
DESTIN_SZSESZ03  0.1032728  0.0048330    21.368  < 2e-16 ***
DESTIN_SZSESZ04 -1.0992420  0.0068328  -160.878  < 2e-16 ***
DESTIN_SZSESZ05 -0.8374712  0.0058155  -144.006  < 2e-16 ***
DESTIN_SZSESZ06 -0.5531619  0.0074766   -73.985  < 2e-16 ***
DESTIN_SZSESZ07 -3.0328672  0.0246371  -123.101  < 2e-16 ***
DESTIN_SZSGSZ01 -0.1933777  0.0068235   -28.340  < 2e-16 ***
DESTIN_SZSGSZ02 -0.3000845  0.0060284   -49.779  < 2e-16 ***
DESTIN_SZSGSZ03 -0.4322879  0.0057308   -75.433  < 2e-16 ***
DESTIN_SZSGSZ04 -0.1214792  0.0056548   -21.482  < 2e-16 ***
DESTIN_SZSGSZ05 -2.0309074  0.0114993  -176.611  < 2e-16 ***
DESTIN_SZSGSZ06  0.6592095  0.0046364   142.182  < 2e-16 ***
DESTIN_SZSGSZ07 -0.4618538  0.0062027   -74.460  < 2e-16 ***
DESTIN_SZSISZ01 -0.5227257  0.0293399   -17.816  < 2e-16 ***
DESTIN_SZSKSZ01 -0.4797341  0.0091087   -52.668  < 2e-16 ***
DESTIN_SZSKSZ02  0.8477357  0.0067821   124.996  < 2e-16 ***
DESTIN_SZSKSZ03 -0.2477566  0.0074817   -33.115  < 2e-16 ***
DESTIN_SZSKSZ04 -1.3315992  0.0167055   -79.710  < 2e-16 ***
DESTIN_SZSKSZ05 -0.3519096  0.0131326   -26.797  < 2e-16 ***
DESTIN_SZSLSZ01 -0.8570431  0.0102100   -83.941  < 2e-16 ***
DESTIN_SZSLSZ04 -0.9949105  0.0088280  -112.699  < 2e-16 ***
DESTIN_SZSRSZ01 -1.0260696  0.0154393   -66.458  < 2e-16 ***
DESTIN_SZTHSZ01 -4.2040410  0.0404795  -103.856  < 2e-16 ***
DESTIN_SZTHSZ03 -2.4907000  0.0264056   -94.325  < 2e-16 ***
DESTIN_SZTHSZ04 -3.0701470  0.0244975  -125.325  < 2e-16 ***
DESTIN_SZTHSZ06 -2.5308161  0.0169699  -149.135  < 2e-16 ***
DESTIN_SZTMSZ01 -0.2354889  0.0067201   -35.042  < 2e-16 ***
DESTIN_SZTMSZ02  1.7379292  0.0044573   389.906  < 2e-16 ***
DESTIN_SZTMSZ03  0.9112458  0.0048718   187.043  < 2e-16 ***
DESTIN_SZTMSZ04  1.0731075  0.0048626   220.685  < 2e-16 ***
DESTIN_SZTMSZ05  0.6398583  0.0067321    95.046  < 2e-16 ***
DESTIN_SZTNSZ01 -0.3500456  0.0083835   -41.754  < 2e-16 ***
DESTIN_SZTNSZ02 -1.0573515  0.0112412   -94.060  < 2e-16 ***
DESTIN_SZTNSZ03 -1.4069979  0.0132733  -106.002  < 2e-16 ***
DESTIN_SZTNSZ04 -0.3616604  0.0085207   -42.445  < 2e-16 ***
DESTIN_SZTPSZ01 -0.5919243  0.0071153   -83.190  < 2e-16 ***
DESTIN_SZTPSZ02  0.7083350  0.0046540   152.198  < 2e-16 ***
DESTIN_SZTPSZ03 -0.5746433  0.0069625   -82.534  < 2e-16 ***
DESTIN_SZTPSZ04 -1.5821259  0.0084517  -187.196  < 2e-16 ***
DESTIN_SZTPSZ05 -1.1796256  0.0073039  -161.505  < 2e-16 ***
DESTIN_SZTPSZ06 -0.3968272  0.0077295   -51.339  < 2e-16 ***
DESTIN_SZTPSZ07 -2.1796617  0.0135199  -161.219  < 2e-16 ***
DESTIN_SZTPSZ08 -1.2568483  0.0107267  -117.170  < 2e-16 ***
DESTIN_SZTPSZ09 -0.2446623  0.0080840   -30.265  < 2e-16 ***
DESTIN_SZTPSZ10 -1.2542191  0.0102049  -122.904  < 2e-16 ***
DESTIN_SZTPSZ11 -0.0886883  0.0062888   -14.102  < 2e-16 ***
DESTIN_SZTPSZ12 -0.7211823  0.0075086   -96.048  < 2e-16 ***
DESTIN_SZTSSZ01 -1.6271921  0.0238498   -68.227  < 2e-16 ***
DESTIN_SZTSSZ02 -0.3340439  0.0169137   -19.750  < 2e-16 ***
DESTIN_SZTSSZ03  0.3924580  0.0111060    35.338  < 2e-16 ***
DESTIN_SZTSSZ04  0.4169932  0.0114926    36.283  < 2e-16 ***
DESTIN_SZTSSZ05  1.3206287  0.0120381   109.704  < 2e-16 ***
DESTIN_SZTSSZ06  2.4023725  0.0192840   124.579  < 2e-16 ***
DESTIN_SZWCSZ01  2.0697378  0.0061379   337.206  < 2e-16 ***
DESTIN_SZWCSZ02 -2.0934025  0.0134782  -155.318  < 2e-16 ***
DESTIN_SZWCSZ03 -3.0670149  0.0349748   -87.692  < 2e-16 ***
DESTIN_SZWDSZ01  1.0113215  0.0051461   196.522  < 2e-16 ***
DESTIN_SZWDSZ02 -1.3383793  0.0076482  -174.993  < 2e-16 ***
DESTIN_SZWDSZ03  0.3394361  0.0060396    56.202  < 2e-16 ***
DESTIN_SZWDSZ04 -0.8324928  0.0086019   -96.780  < 2e-16 ***
DESTIN_SZWDSZ05 -0.8279090  0.0083251   -99.447  < 2e-16 ***
DESTIN_SZWDSZ06 -0.2252899  0.0061074   -36.888  < 2e-16 ***
DESTIN_SZWDSZ07 -1.3638599  0.0077990  -174.877  < 2e-16 ***
DESTIN_SZWDSZ08 -0.4350176  0.0077566   -56.083  < 2e-16 ***
DESTIN_SZWDSZ09  0.5461048  0.0060745    89.901  < 2e-16 ***
DESTIN_SZYSSZ01  0.0243093  0.0053476     4.546 5.47e-06 ***
DESTIN_SZYSSZ02 -0.3398962  0.0065947   -51.540  < 2e-16 ***
DESTIN_SZYSSZ03 -0.3694187  0.0074032   -49.900  < 2e-16 ***
DESTIN_SZYSSZ04 -0.5222848  0.0067396   -77.495  < 2e-16 ***
DESTIN_SZYSSZ05 -1.5460539  0.0124899  -123.784  < 2e-16 ***
DESTIN_SZYSSZ06 -1.5556892  0.0127640  -121.881  < 2e-16 ***
DESTIN_SZYSSZ07 -0.8673403  0.0167723   -51.713  < 2e-16 ***
DESTIN_SZYSSZ08  0.5389364  0.0052540   102.577  < 2e-16 ***
DESTIN_SZYSSZ09  0.1199483  0.0055235    21.716  < 2e-16 ***
log(dist)       -1.8906989  0.0005319 -3554.786  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 36117615  on 14273  degrees of freedom
Residual deviance:  8091747  on 13715  degrees of freedom
AIC: 8177420

Number of Fisher Scoring iterations: 7

We can examine how the constraints hold for destinations this time.

CalcRSquared(dbcSIM$data$TRIPS, dbcSIM$fitted.values)
[1] 0.6883675

Notice that there is a relatively greater improvement in the R^2 value.

16.13.9 Model comparison

Another useful model performance measure for continuous dependent variable is Root Mean Squared Error. In this sub-section, you will learn how to use compare_performance() of performance package

First of all, let us create a list called model_list by using the code chun below.

model_list <- list(unconstrained=uncSIM,
                   originConstrained=orcSIM,
                   destinationConstrained=decSIM,
                   doublyConstrained=dbcSIM)

Next, we will compute the RMSE of all the models in model_list file by using the code chunk below.

compare_performance(model_list,
                    metrics = "RMSE")
# Comparison of Model Performance Indices

Name                   | Model |     RMSE
-----------------------------------------
unconstrained          |   glm | 2429.978
originConstrained      |   glm | 2057.579
destinationConstrained |   glm | 1891.724
doublyConstrained      |   glm | 1487.111

The print above reveals that doubly constrained SIM is the best model among all the four SIMs because it has the smallest RMSE value of 1487.111.

16.13.10 Visualising fitted

In this section, you will learn how to visualise the observed values and the fitted values.

Firstly we will extract the fitted values from each model by using the code chunk below.

df <- as.data.frame(uncSIM$fitted.values) %>%
  round(digits = 0)

Next, we will join the values to SIM_data data frame.

SIM_data <- SIM_data %>%
  cbind(df) %>%
  rename(uncTRIPS = "uncSIM$fitted.values")

Repeat the same step by for Origin Constrained SIM (i.e. orcSIM)

df <- as.data.frame(orcSIM$fitted.values) %>%
  round(digits = 0)
SIM_data <- SIM_data %>%
  cbind(df) %>%
  rename(orcTRIPS = "orcSIM$fitted.values")

Repeat the same step by for Destination Constrained SIM (i.e. decSIM)

df <- as.data.frame(decSIM$fitted.values) %>%
  round(digits = 0)
SIM_data <- SIM_data %>%
  cbind(df) %>%
  rename(decTRIPS = "decSIM$fitted.values")

Repeat the same step by for Doubly Constrained SIM (i.e. dbcSIM)

df <- as.data.frame(dbcSIM$fitted.values) %>%
  round(digits = 0)
SIM_data <- SIM_data %>%
  cbind(df) %>%
  rename(dbcTRIPS = "dbcSIM$fitted.values")
unc_p <- ggplot(data = SIM_data,
                aes(x = uncTRIPS,
                    y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

orc_p <- ggplot(data = SIM_data,
                aes(x = orcTRIPS,
                    y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

dec_p <- ggplot(data = SIM_data,
                aes(x = decTRIPS,
                    y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

dbc_p <- ggplot(data = SIM_data,
                aes(x = dbcTRIPS,
                    y = TRIPS)) +
  geom_point() +
  geom_smooth(method = lm)

ggarrange(unc_p, orc_p, dec_p, dbc_p,
          ncol = 2,
          nrow = 2)